From a73a28588f72fe7ec00bff53d4f0ba07be91b8aa Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Thu, 20 Mar 2014 05:25:40 -0400 Subject: [PATCH] Factor out copy_cmdarg() to common ncmlib header. --- ndhc/ndhc.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/ndhc/ndhc.c b/ndhc/ndhc.c index 09f5237..f1e7801 100644 --- a/ndhc/ndhc.c +++ b/ndhc/ndhc.c @@ -70,6 +70,7 @@ #include "seccomp.h" #include "ifchd.h" #include "duiaid.h" +#include "copy_cmdarg.h" struct client_state_t cs = { .ifchWorking = 0, @@ -418,19 +419,6 @@ void background(void) write_pid(pidfile); } -static void copy_cmdarg(char *dest, char *src, size_t destlen, char *argname) -{ - ssize_t olen = snprintf(dest, destlen, "%s", src); - if (olen < 0) { - log_error("snprintf failed on %s; your system is broken?", argname); - exit(EXIT_FAILURE); - } - if ((size_t)olen >= destlen) { - log_error("snprintf would truncate %s arg; it's too long", argname); - exit(EXIT_FAILURE); - } -} - int main(int argc, char **argv) { static const struct option arg_options[] = {