roken: fix valgrind leak noise

This commit is contained in:
Nicolas Williams
2020-04-23 20:44:32 -05:00
parent d6e9584d6c
commit 9794f02245

View File

@@ -52,7 +52,7 @@ roken_detach_prep(int argc, char **argv, char *special_arg)
pid_t child; pid_t child;
char **new_argv; char **new_argv;
char buf[1]; char buf[1];
char *fildes; char fildes[21];
int status; int status;
pipefds[0] = -1; pipefds[0] = -1;
@@ -78,9 +78,9 @@ roken_detach_prep(int argc, char **argv, char *special_arg)
fcntl(pipefds[1], F_SETFD, fcntl(pipefds[1], F_GETFD & ~(O_CLOEXEC))); fcntl(pipefds[1], F_SETFD, fcntl(pipefds[1], F_GETFD & ~(O_CLOEXEC)));
#endif #endif
if (asprintf(&fildes, "%d", pipefds[1]) == -1 || if (snprintf(fildes, sizeof(fildes), "%d", pipefds[1]) >= sizeof(fildes))
fildes == NULL) err(1, "failed to setup to detach daemon (fd number %d too large)",
err(1, "failed to setup to detach daemon (_dup failed)"); pipefds[1]);
new_argv[0] = argv[0]; new_argv[0] = argv[0];
new_argv[1] = special_arg; new_argv[1] = special_arg;