]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
add fd to ignore to lxc_check_inherited function
authorMichel Normand <normand@fr.ibm.com>
Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Thu, 29 Apr 2010 08:03:59 +0000 (10:03 +0200)
Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/start.c
src/lxc/start.h

index cd2b237f891f8c4fd057fd765267e79f9400ca8a..57a28e87f6b132b7fc91d871c3a370e00cbfb8af 100644 (file)
@@ -113,7 +113,7 @@ static int match_fd(int fd)
        return (fd == 0 || fd == 1 || fd == 2);
 }
 
-int lxc_check_inherited(void)
+int lxc_check_inherited(int fd_to_ignore)
 {
        struct dirent dirent, *direntp;
        int fd, fddir;
@@ -143,7 +143,7 @@ int lxc_check_inherited(void)
 
                fd = atoi(direntp->d_name);
 
-               if (fd == fddir || fd == lxc_log_fd)
+               if (fd == fddir || fd == lxc_log_fd || fd == fd_to_ignore)
                        continue;
 
                if (match_fd(fd))
@@ -535,7 +535,7 @@ int lxc_start(const char *name, char *const argv[], struct lxc_conf *conf)
        int err = -1;
        int status;
 
-       if (lxc_check_inherited())
+       if (lxc_check_inherited(-1))
                return -1;
 
        handler = lxc_init(name, conf);
index 68be286d347b65d1e570abc2fdecdfc460b032b9..e69480a5794b984b4f27b00eda45c098bb96b4a9 100644 (file)
@@ -46,7 +46,7 @@ extern int lxc_poll(const char *name, struct lxc_handler *handler);
 extern void lxc_abort(const char *name, struct lxc_handler *handler);
 extern void lxc_fini(const char *name, struct lxc_handler *handler);
 extern int lxc_set_state(const char *, struct lxc_handler *, lxc_state_t);
-extern int lxc_check_inherited(void);
+extern int lxc_check_inherited(int fd_to_ignore);
 
 #endif