fstools: fix a couple of minor code problems
[project/fstools.git] / libfstools / mount.c
index 1691ce747f50921423e1ca43709549c612b6d1be..3d4111fe6b58c7d46ba96038c7fc571005f308cd 100644 (file)
@@ -143,8 +143,11 @@ fopivot(char *rw_root, char *ro_root)
         * We can't really deal with these constraints without
         * creating two new subdirectories in /overlay.
         */
-       mkdir(upperdir, 0755);
-       mkdir(workdir, 0755);
+       if (mkdir(upperdir, 0755) == -1 && errno != EEXIST)
+               return -1;
+
+       if (mkdir(workdir, 0755) == -1 && errno != EEXIST)
+               return -1;
 
        if (stat(upgrade, &st) == 0)
                rename(upgrade, upgrade_dest);