]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
discover-image: extend r/o check on images via path
authorLennart Poettering <lennart@poettering.net>
Mon, 9 Dec 2024 11:48:54 +0000 (12:48 +0100)
committerMike Yuan <me@yhndnzj.com>
Tue, 10 Dec 2024 19:53:56 +0000 (20:53 +0100)
If we have no path, let's check the parent's path.

src/shared/discover-image.c

index 82e0ad4c027238ac0a384ab6a4fcd1cf0b40f423..82be0b73d8aa8cb26ce16de7c889873284c872aa 100644 (file)
@@ -356,6 +356,7 @@ static int image_make(
 
         read_only =
                 (path && path_startswith(path, "/usr")) ||
+                (parent && path_startswith(parent, "/usr")) ||
                 (faccessat(dfd, filename, W_OK, AT_EACCESS) < 0 && errno == EROFS);
 
         if (S_ISDIR(st->st_mode)) {