]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
mount: Cleanup auto-creating mount targets
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 19 Nov 2022 15:01:12 +0000 (15:01 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 19 Nov 2022 15:01:12 +0000 (15:01 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/mount.c

index 6e63db18a2077529cb9b201147206eeed980cbe6..c00bc658f5b6cf748b4169fe242e707fecba1187 100644 (file)
@@ -347,26 +347,19 @@ int pakfire_mount_all(struct pakfire* pakfire) {
                if (r)
                        return r;
 
-               // Create target
-               pakfire_mkdir(target, 0755);
+               // Create target if it doesn't exist
+               if (!pakfire_path_exists(target)) {
+                       r = pakfire_mkdir(target, 0755);
+                       if (r) {
+                               ERROR(pakfire, "Could not create %s: %m\n", target);
+                               return r;
+                       }
+               }
 
-RETRY:
                // Perform mount()
                r = pakfire_mount(pakfire, mp->source, target, mp->fstype, mp->flags, mp->options);
-               if (r) {
-                       // If the target directory does not exist, we will create it
-                       if (errno == ENOENT) {
-                               r = pakfire_mkdir(target, 0755);
-                               if (r) {
-                                       ERROR(pakfire, "Could not create %s\n", target);
-                                       return r;
-                               }
-
-                               goto RETRY;
-                       }
-
+               if (r)
                        return r;
-               }
        }
 
        // Populate /dev