Move LOG_I earlier in subproc.c
authorJagger <robert@swiecki.net>
Sat, 17 Oct 2015 17:11:48 +0000 (19:11 +0200)
committerJagger <robert@swiecki.net>
Sat, 17 Oct 2015 17:11:48 +0000 (19:11 +0200)
subproc.c

index af0d3a7cbf6cb65af4da1281779dda450d9d9b32..1943edf0db9e1a7ac1130b66bbefce9577887983 100644 (file)
--- a/subproc.c
+++ b/subproc.c
@@ -254,8 +254,11 @@ void subprocRunChild(struct nsjconf_t *nsjconf, int fd_in, int fd_out, int fd_er
                LOG_E("Couldn't create and put MACVTAP interface into NS of PID '%d'", pid);
        }
 
-       char log_buf[4096];
+       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);
 
+       char log_buf[4096];
        close(pipefd[1]);
        ssize_t sz;
        while ((sz = read(pipefd[0], log_buf, sizeof(log_buf) - 1)) > 0) {
@@ -265,8 +268,4 @@ void subprocRunChild(struct nsjconf_t *nsjconf, int fd_in, int fd_out, int fd_er
        close(pipefd[0]);
 
        subprocAdd(nsjconf, pid, fd_in);
-
-       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);
 }