tree-wide: check if return value of lseek() and friends is negative
We usually check return value of syscalls or glibc functions by it is negative or not, something like that `if (stat(path, &st) < 0)`. Let's also use the same style for lseek() and friends even the type of their return value is off_t. Note, fseeko() returns int, instead of off_t.
This commit is contained in:
@@ -233,7 +233,7 @@ static int copy_file_with_version_check(const char *from, const char *to, bool f
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (lseek(fd_from, 0, SEEK_SET) == (off_t) -1)
|
||||
if (lseek(fd_from, 0, SEEK_SET) < 0)
|
||||
return log_error_errno(errno, "Failed to seek in \"%s\": %m", from);
|
||||
|
||||
fd_to = safe_close(fd_to);
|
||||
|
||||
Reference in New Issue
Block a user