summaryrefslogtreecommitdiffstats
path: root/debian/patches/upstream/0011-sfdisk-improve-code-readability-for-coverity-scan.patch
blob: dc707cb1feeaab93d23e022b58755952a39a4be3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: Karel Zak <kzak@redhat.com>
Date: Thu, 11 Aug 2022 13:04:58 +0200
Subject: [PATCH 11/24] sfdisk: improve code readability for coverity scan

Signed-off-by: Karel Zak <kzak@redhat.com>
---
 disk-utils/sfdisk.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index 38c7b17..112bc7c 100644
--- a/disk-utils/sfdisk.c
+++ b/disk-utils/sfdisk.c
@@ -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);