]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: suppress complaints about lack of BLKRRPART when operating on regular file
authorLennart Poettering <lennart@poettering.net>
Tue, 12 May 2020 15:08:39 +0000 (17:08 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 14 May 2020 21:01:09 +0000 (23:01 +0200)
src/partition/repart.c

index 6af3871c3567e4eb7cbe592dbe1e7614ae789ae8..0622e707868bc0fa08f165b13692a122ab3374c2 100644 (file)
@@ -2256,7 +2256,7 @@ static int device_kernel_partitions_supported(int fd) {
         if (fstat(fd, &st) < 0)
                 return log_error_errno(fd, "Failed to fstat() image file: %m");
         if (!S_ISBLK(st.st_mode))
-                return false;
+                return -ENOTBLK; /* we do not log in this one special case about errors */
 
         if (ioctl(fd, LOOP_GET_STATUS64, &info) < 0) {
 
@@ -2461,9 +2461,11 @@ static int context_write_partition_table(
                 return log_error_errno(r, "Failed to write partition table: %m");
 
         capable = device_kernel_partitions_supported(fdisk_get_devfd(context->fdisk_context));
-        if (capable < 0)
+        if (capable == -ENOTBLK)
+                log_debug("Not telling kernel to reread partition table, since we are not operating on a block device.");
+        else if (capable < 0)
                 return capable;
-        if (capable > 0) {
+        else if (capable > 0) {
                 log_info("Telling kernel to reread partition table.");
 
                 if (from_scratch)