]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Fix forked process should exit instead of returning on error
authordlezcano <dlezcano>
Wed, 3 Sep 2008 16:13:50 +0000 (16:13 +0000)
committerdlezcano <dlezcano>
Wed, 3 Sep 2008 16:13:50 +0000 (16:13 +0000)
src/liblxc/execute.c

index 4bfcbcc30eb337eba95f4afb9c57a5ecdbace3a5..a73856dfe990505ad989b2efe196bc8f0e5906dc 100644 (file)
@@ -121,11 +121,12 @@ int lxc_execute(const char *name, int argc, char *argv[],
                                goto error;
                        }
 
-                       if (mount("sysfs", "/sys", "sysfs", 0, NULL)) {
-                               lxc_log_syserror("failed to mount '/sys'");
-                               /* continue: non fatal error until sysfs not per
-                                namespace */
-                       }
+                       if (conf_has_network(name))
+                               if (mount("sysfs", "/sys", "sysfs", 0, NULL)) {
+                                       lxc_log_syserror("failed to mount '/sys'");
+                                       /* continue: non fatal error until sysfs not per
+                                          namespace */
+                               }
 
                        if (preexec)
                                if (preexec(name, argc, argv, data)) {
@@ -134,12 +135,12 @@ int lxc_execute(const char *name, int argc, char *argv[],
                                }
 
                        execvp(argv[0], argv);
-               error:
                        lxc_log_syserror("failed to exec %s", argv[0]);
+               error:
                        if (write(sv[0], &sync, sizeof(sync)) < 0)
                                lxc_log_syserror("failed to write the socket");
                        
-                       return 1;
+                       exit(1);
                }
 
                setsid();