discover-image: don't ignore symlinks to raw images
Since5c6bb28999image_discover() uses chaseat() to chase the path to the image. This however breaks the raw image check in image_make() as "path" is now not the symlink itself, but the symlink target. So with: $ ls -l /var/lib/machines total 872104 lrwxrwxrwx. 1 root root 12 Jul 14 06:10 foo.raw -> foo.squashfs -rw-r--r--. 1 root root 5368709120 Jul 13 02:07 foo.squashfs The endswith(path, ".raw") check is now performed on "/.../foo.squashfs" instead of "/.../foo.raw", making it false and thus ignoring the image symlink completely. Address this by also checking if the pretty name is set - if so, and the path is a regular file, the caller must've been image_find() or image_discover() which already checked if the original path ends in .raw and is a regular file. Follow-up for5c6bb28999. Resolves: #41656
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
0755bb125c
commit
f9348b3bc8
@@ -618,7 +618,7 @@ static int image_make(
|
||||
(*ret)->foreign_uid_owned = uid_is_foreign(st->st_uid);
|
||||
return 0;
|
||||
|
||||
} else if (S_ISREG(st->st_mode) && endswith(path, ".raw")) {
|
||||
} else if (S_ISREG(st->st_mode) && (endswith(path, ".raw") || pretty)) {
|
||||
usec_t crtime = 0;
|
||||
|
||||
/* It's a RAW disk image */
|
||||
|
||||
Reference in New Issue
Block a user