static bool containMakeFdsCOENaive(struct nsjconf_t *nsjconf)
{
- // Don't use getrlimit(RLIMIT_NOFILE) here, as it can return an artifically small value
- // (e.g. 32), which could be smaller than a maximum assigned number to file-descriptors
- // in this process. Just use some reasonably sane value (e.g. 1024)
+ /*
+ * Don't use getrlimit(RLIMIT_NOFILE) here, as it can return an artifically small value
+ * (e.g. 32), which could be smaller than a maximum assigned number to file-descriptors
+ * in this process. Just use some reasonably sane value (e.g. 1024)
+ */
for (unsigned fd = 0; fd < 1024; fd++) {
int flags = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFD, 0));
if (flags == -1) {
logfile = _LOG_DEFAULT_FILE;
}
if (logfile == NULL) {
- log_fd = STDERR_FILENO;
+ log_fd = fcntl(log_fd, F_DUPFD_CLOEXEC);
} else {
if (TEMP_FAILURE_RETRY(log_fd = open(logfile, O_CREAT | O_RDWR | O_APPEND, 0640)) ==
-1) {
putenv(p->val);
}
- LOG_D("Trying to execve('%s')", nsjconf->argv[0]);
+ char cs_addr[64];
+ netConnToText(fd_in, true /* remote */ , cs_addr, sizeof(cs_addr), NULL);
+ LOG_I("Executing '%s' for '%s'", nsjconf->argv[0], cs_addr);
+
for (size_t i = 0; nsjconf->argv[i]; i++) {
LOG_D(" Arg[%zu]: '%s'", i, nsjconf->argv[i]);
}
close(parent_fd);
char cs_addr[64];
netConnToText(fd_in, true /* remote */ , cs_addr, sizeof(cs_addr), NULL);
- LOG_I("PID: %d about to execute '%s' for %s", pid, nsjconf->argv[0], cs_addr);
}
int subprocSystem(const char **argv, char **env)