Better logging for closing(fd)
authorJagger <robert@swiecki.net>
Sat, 18 Jun 2016 09:08:35 +0000 (11:08 +0200)
committerJagger <robert@swiecki.net>
Sat, 18 Jun 2016 09:08:35 +0000 (11:08 +0200)
contain.c

index beeb67d2ce6ebb052858c235c27315ef0522fdba..5614fc824fad628a1891a5bdd89a72306e0f2f40 100644 (file)
--- a/contain.c
+++ b/contain.c
@@ -191,7 +191,6 @@ static bool containPassFd(struct nsjconf_t *nsjconf, int fd)
        struct fds_t *p;
        TAILQ_FOREACH(p, &nsjconf->open_fds, pointers) {
                if (p->fd == fd) {
-                       LOG_D("FD=%d will be passed to the child process", fd);
                        return true;
                }
        }
@@ -209,6 +208,7 @@ static bool containMakeFdsCOENaive(struct nsjconf_t *nsjconf)
                        continue;
                }
                if (containPassFd(nsjconf, fd)) {
+                       LOG_D("FD=%d will be passed to the child process", fd);
                        TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags & ~(FD_CLOEXEC)));
                } else {
                        TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags | FD_CLOEXEC));
@@ -255,8 +255,10 @@ static bool containMakeFdsCOEProc(struct nsjconf_t *nsjconf)
                        return false;
                }
                if (containPassFd(nsjconf, fd)) {
+                       LOG_D("FD=%d will be passed to the child process", fd);
                        TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags & ~(FD_CLOEXEC)));
                } else {
+                       LOG_D("FD=%d will be closed before execve()", fd);
                        TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags | FD_CLOEXEC));
                }
        }