From: Roy Marples Date: Thu, 5 Feb 2009 21:06:57 +0000 (+0000) Subject: Log our control commands. X-Git-Tag: v5.0.0~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63170def69524476fd43495ab1767b8690c0e9b5;p=thirdparty%2Fdhcpcd.git Log our control commands. --- 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) {