]> git.proxmox.com Git - mirror_lxc.git/blobdiff - src/lxc/conf.c
spelling: output
[mirror_lxc.git] / src / lxc / conf.c
index e822e90d30a01f608d72e66c218be6713df4c110..52ec8731b82d627578143cf47392234321455c4e 100644 (file)
@@ -1397,7 +1397,7 @@ int lxc_chroot(const struct lxc_rootfs *rootfs)
                return -1;
        }
 
-       /* The following code cleans up inhereted mounts which are not required
+       /* The following code cleans up inherited mounts which are not required
         * for CT.
         *
         * The mountinfo file shows not all mounts, if a few points have been
@@ -1494,15 +1494,16 @@ int lxc_chroot(const struct lxc_rootfs *rootfs)
  */
 static int lxc_pivot_root(const char *rootfs)
 {
-       int newroot = -1, oldroot = -1, ret = -1;
+       int oldroot;
+       int newroot = -1, ret = -1;
 
-       oldroot = open("/", O_DIRECTORY | O_RDONLY);
+       oldroot = open("/", O_DIRECTORY | O_RDONLY | O_CLOEXEC);
        if (oldroot < 0) {
                SYSERROR("Failed to open old root directory");
                return -1;
        }
 
-       newroot = open(rootfs, O_DIRECTORY | O_RDONLY);
+       newroot = open(rootfs, O_DIRECTORY | O_RDONLY | O_CLOEXEC);
        if (newroot < 0) {
                SYSERROR("Failed to open new root directory");
                goto on_error;
@@ -1564,9 +1565,9 @@ static int lxc_pivot_root(const char *rootfs)
        TRACE("pivot_root(\"%s\") successful", rootfs);
 
 on_error:
-       if (oldroot != -1)
-               close(oldroot);
-       if (newroot != -1)
+       close(oldroot);
+
+       if (newroot >= 0)
                close(newroot);
 
        return ret;
@@ -2419,10 +2420,6 @@ FILE *make_anonymous_mount_file(struct lxc_list *mount,
 
                TRACE("Created temporary mount file");
        }
-       if (fd < 0) {
-               SYSERROR("Could not create temporary mount file");
-               return NULL;
-       }
 
        lxc_list_for_each (iterator, mount) {
                size_t len;
@@ -2919,7 +2916,7 @@ static int idmaptool_on_path_and_privileged(const char *binary, cap_value_t cap)
         * of the doubt. Otherwise we might fail even though all the necessary
         * file capabilities are set.
         */
-       DEBUG("Cannot check for file capabilites as full capability support is "
+       DEBUG("Cannot check for file capabilities as full capability support is "
              "missing. Manual intervention needed");
        fret = 1;
 #endif
@@ -3043,7 +3040,7 @@ int lxc_map_ids(struct lxc_list *idmap, pid_t pid)
                if (!had_entry)
                        continue;
 
-               /* Try to catch the ouput of new{g,u}idmap to make debugging
+               /* Try to catch the output of new{g,u}idmap to make debugging
                 * easier.
                 */
                if (use_shadow) {
@@ -4363,7 +4360,7 @@ on_error:
  * - the container root {g,u}id as seen from the host > user's host {g,u}id
  * - the container root -> some sub{g,u}id
  * The former we add, if the user did not specifiy a mapping. The latter we
- * retrieve from the ontainer's configured {g,u}id mappings as it must have been
+ * retrieve from the container's configured {g,u}id mappings as it must have been
  * there to start the container in the first place.
  */
 int userns_exec_1(struct lxc_conf *conf, int (*fn)(void *), void *data,