summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2000-12-08 19:35:51 +0000
committerEric Andersen2000-12-08 19:35:51 +0000
commit9cff4fbac91bdd63acbed23b732d76c56177ca62 (patch)
treeaa6dac97487324c215bea690e8ad73c99e0c487c
parent5e09b6e3a83c83fe3db99ef9f8b2cdf6dc21cec4 (diff)
downloadbusybox-9cff4fbac91bdd63acbed23b732d76c56177ca62.zip
busybox-9cff4fbac91bdd63acbed23b732d76c56177ca62.tar.gz
Patch from Matt Kraai to make logger log all arguments.
-rw-r--r--Changelog1
-rw-r--r--logger.c15
-rw-r--r--sysklogd/logger.c15
3 files changed, 25 insertions, 6 deletions
diff --git a/Changelog b/Changelog
index 9021211..3095c95 100644
--- a/Changelog
+++ b/Changelog
@@ -45,6 +45,7 @@
* Mark Whitley -- remix of xargs
* Jim Gleason <jimg@lineo.com> -- fixed tar so it no longer breaks
hard links.
+ * Matt Kraai -- logger now logs all arguments, not just the first
-Erik Andersen
diff --git a/logger.c b/logger.c
index 1ed6dc6..1c454e5 100644
--- a/logger.c
+++ b/logger.c
@@ -149,10 +149,19 @@ extern int logger_main(int argc, char **argv)
}
message = buf;
} else {
- if (argc >= 1)
- message = *argv;
- else
+ if (argc >= 1) {
+ int len = 1; /* for the '\0' */
+ for (; *argv != NULL; argv++) {
+ len += strlen(*argv);
+ len += 1; /* for the space between the args */
+ message = xrealloc(message, len);
+ strcat(message, *argv);
+ strcat(message, " ");
+ }
+ message[strlen(message)-1] = '\0';
+ } else {
error_msg_and_die("No message\n");
+ }
}
openlog(name, option, (pri | LOG_FACMASK));
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index 1ed6dc6..1c454e5 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -149,10 +149,19 @@ extern int logger_main(int argc, char **argv)
}
message = buf;
} else {
- if (argc >= 1)
- message = *argv;
- else
+ if (argc >= 1) {
+ int len = 1; /* for the '\0' */
+ for (; *argv != NULL; argv++) {
+ len += strlen(*argv);
+ len += 1; /* for the space between the args */
+ message = xrealloc(message, len);
+ strcat(message, *argv);
+ strcat(message, " ");
+ }
+ message[strlen(message)-1] = '\0';
+ } else {
error_msg_and_die("No message\n");
+ }
}
openlog(name, option, (pri | LOG_FACMASK));