From df7e4aeeed27c35994bc12614d5ffcb82ec6497b Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 29 Jul 2022 19:30:26 +0200 Subject: fsutil/fs_normslice: define *offset == 0 when *length == 0 --- src/shared/fsutil.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/shared/fsutil.c') diff --git a/src/shared/fsutil.c b/src/shared/fsutil.c index a1dabfd..45a64f6 100644 --- a/src/shared/fsutil.c +++ b/src/shared/fsutil.c @@ -45,11 +45,9 @@ void fs_normslice(long *restrict offset, size_t *restrict length, size_t max, bo } end: - if (*length > 0) { - assert(0 <= *offset); - if (!expand) - assert(*offset + *length <= max); - } else { - /* EOF, *offset is undefined. */ - } + if (*length == 0) *offset = 0; + + assert(0 <= *offset); + if (!expand) + assert(*offset + *length <= max); } -- cgit v1.2.3