summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-02-05 21:06:57 +0000
committerRoy Marples <roy@marples.name>2009-02-05 21:06:57 +0000
commit63170def69524476fd43495ab1767b8690c0e9b5 (patch)
tree630718cff26445c4e32a56977dc71684c61272ef
parent73454ab163177c8684631ea234b24ee2782a6fb9 (diff)
downloaddhcpcd-63170def69524476fd43495ab1767b8690c0e9b5.tar.xz
Log our control commands.
-rw-r--r--dhcpcd.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index acf30b18..39f849f8 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1115,7 +1115,9 @@ handle_args(struct fd_list *fd, int argc, char **argv)
struct interface *ifs, *ifp, *ifl, *ifn, *ift;
int do_exit = 0, do_release = 0, do_reboot = 0, opt, oi = 0;
ssize_t len;
+ size_t l;
struct iovec iov[2];
+ char *tmp, *p;
if (fd != NULL) {
/* Special commands for our control socket */
@@ -1161,6 +1163,21 @@ handle_args(struct fd_list *fd, int argc, char **argv)
}
}
+ /* Log the command */
+ len = 0;
+ for (opt = 0; opt < argc; opt++)
+ len += strlen(argv[opt]) + 1;
+ tmp = p = xmalloc(len + 1);
+ for (opt = 0; opt < argc; opt++) {
+ l = strlen(argv[opt]);
+ strlcpy(p, argv[opt], l + 1);
+ p += l;
+ *p++ = ' ';
+ }
+ *--p = '\0';
+ syslog(LOG_INFO, "control command: %s", tmp);
+ free(tmp);
+
optind = 0;
while ((opt = getopt_long(argc, argv, IF_OPTS, cf_options, &oi)) != -1)
{