]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysext: Fail when trying to import mutable layer that's a symlink to hierarchy
authorKrzesimir Nowak <knowak@microsoft.com>
Wed, 28 Feb 2024 15:34:05 +0000 (16:34 +0100)
committerKrzesimir Nowak <knowak@microsoft.com>
Mon, 25 Mar 2024 07:33:31 +0000 (08:33 +0100)
src/sysext/sysext.c

index 267c90f9764825780eece6a12baa1baf6cbfd449..b984e9b9a0742238c6b8ab65903af9a57fd4ef0e 100644 (file)
@@ -880,10 +880,8 @@ static int maybe_import_mutable_directory(OverlayFSPaths *op) {
         r = resolved_paths_equal(op->resolved_hierarchy, op->resolved_mutable_directory);
         if (r < 0)
                 return log_error_errno(r, "Failed to check equality of hierarchy %s and its mutable directory %s: %m", op->resolved_hierarchy, op->resolved_mutable_directory);
-        if (r > 0) {
-                log_debug("Not importing mutable directory for hierarchy %s as a lower dir, because it points to the hierarchy itself", op->hierarchy);
-                return 0;
-        }
+        if (r > 0)
+                return log_error_errno(SYNTHETIC_ERRNO(ELOOP), "Not importing mutable directory for hierarchy %s as a lower dir, because it points to the hierarchy itself", op->hierarchy);
 
         r = strv_extend(&op->lower_dirs, op->resolved_mutable_directory);
         if (r < 0)
@@ -919,10 +917,8 @@ static int maybe_import_ignored_mutable_directory(OverlayFSPaths *op) {
         if (r < 0)
                 return log_error_errno(r, "Failed to check equality of hierarchy %s and its mutable directory %s: %m", op->resolved_hierarchy, op->resolved_mutable_directory);
 
-        if (r > 0) {
-                log_debug("Not importing mutable directory for hierarchy %s as a lower dir, because it points to the hierarchy itself", op->hierarchy);
-                return 0;
-        }
+        if (r > 0)
+                return log_error_errno(SYNTHETIC_ERRNO(ELOOP), "Not importing mutable directory for hierarchy %s as a lower dir, because it points to the hierarchy itself", op->hierarchy);
 
         r = strv_consume(&op->lower_dirs, TAKE_PTR(resolved_path));
         if (r < 0)