summaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorKarel Zak2019-05-23 15:17:16 +0200
committerKarel Zak2019-05-23 15:17:16 +0200
commitedf9c218c1d8e1c5068dfe82c3fc723a51099510 (patch)
tree611bae5fc16fe7950e18853224ab177d6ff2a74e /sys-utils
parentdmesg: make strtok() use more robust (diff)
downloadkernel-qcow2-util-linux-edf9c218c1d8e1c5068dfe82c3fc723a51099510.tar.gz
kernel-qcow2-util-linux-edf9c218c1d8e1c5068dfe82c3fc723a51099510.tar.xz
kernel-qcow2-util-linux-edf9c218c1d8e1c5068dfe82c3fc723a51099510.zip
fallocate: make posix_fadvise() use more readable for analyzers
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/fallocate.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c
index 04a3eaff5..15dcbb0a6 100644
--- a/sys-utils/fallocate.c
+++ b/sys-utils/fallocate.c
@@ -219,8 +219,11 @@ static void dig_holes(int fd, off_t file_off, off_t len)
if (file_end && end > file_end)
end = file_end;
+ if (off < 0 || end < 0)
+ break;
+
#if defined(POSIX_FADV_SEQUENTIAL) && defined(HAVE_POSIX_FADVISE)
- posix_fadvise(fd, off, end, POSIX_FADV_SEQUENTIAL);
+ (void) posix_fadvise(fd, off, end, POSIX_FADV_SEQUENTIAL);
#endif
/*
* Dig holes in the area
@@ -251,7 +254,7 @@ static void dig_holes(int fd, off_t file_off, off_t len)
size_t clen = off - cache_start;
clen = (clen / cachesz) * cachesz;
- posix_fadvise(fd, cache_start, clen, POSIX_FADV_DONTNEED);
+ (void) posix_fadvise(fd, cache_start, clen, POSIX_FADV_DONTNEED);
cache_start = cache_start + clen;
}
#endif