]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
homework: correct error passed into log message
authorLennart Poettering <lennart@poettering.net>
Mon, 17 Aug 2020 18:20:47 +0000 (20:20 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 18 Aug 2020 10:41:22 +0000 (12:41 +0200)
src/home/homework-luks.c

index 7ce59c8bf331960cb688661cb1dcbbea7cb5eb2b..fea00091f6217b93308fc7b3ad841de898f164b8 100644 (file)
@@ -1110,7 +1110,9 @@ int home_prepare_luks(
                 if (fstat(fd, &st) < 0)
                         return log_error_errno(errno, "Failed to fstat() image file: %m");
                 if (!S_ISREG(st.st_mode) && !S_ISBLK(st.st_mode))
-                        return log_error_errno(errno, "Image file %s is not a regular file or block device: %m", ip);
+                        return log_error_errno(
+                                        S_ISDIR(st.st_mode) ? SYNTHETIC_ERRNO(EISDIR) : SYNTHETIC_ERRNO(EBADFD),
+                                        "Image file %s is not a regular file or block device: %m", ip);
 
                 r = luks_validate(fd, user_record_user_name_and_realm(h), h->partition_uuid, &found_partition_uuid, &offset, &size);
                 if (r < 0)