]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sfdisk: improve code readability for coverity scan
authorKarel Zak <kzak@redhat.com>
Thu, 11 Aug 2022 11:04:58 +0000 (13:04 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 11 Aug 2022 11:04:58 +0000 (13:04 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/sfdisk.c

index 38c7b17986d159410ada2142aa04c6d591ac74a8..112bc7c61c7b0869aa968f0c73da36314cefcaa2 100644 (file)
@@ -435,7 +435,6 @@ static int move_partition_data(struct sfdisk *sf, size_t partno, struct fdisk_pa
        from = fdisk_partition_get_start(orig_pa);
        to = fdisk_partition_get_start(pa);
 
-
        if ((to >= from && from + nsectors >= to) ||
            (from >= to && to + nsectors >= from)) {
                /* source and target overlay, check if we need to copy
@@ -462,7 +461,8 @@ static int move_partition_data(struct sfdisk *sf, size_t partno, struct fdisk_pa
 
 #if defined(POSIX_FADV_SEQUENTIAL) && defined(HAVE_POSIX_FADVISE)
        if (!backward)
-               posix_fadvise(fd, from * ss, nsectors * ss, POSIX_FADV_SEQUENTIAL);
+               ignore_result( posix_fadvise(fd, from * ss,
+                                       nsectors * ss, POSIX_FADV_SEQUENTIAL) );
 #endif
        devname = fdisk_partname(fdisk_get_devname(sf->cxt), partno+1);
        if (sf->move_typescript)
@@ -608,7 +608,7 @@ next:
                        src += step_bytes, dst += step_bytes;
        }
 
-       if (progress) {
+       if (progress && nsectors) {
                int x = get_terminal_width(80);
                for (; x > 0; x--)
                        fputc(' ', stdout);