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:
Yu Watanabe
2023-10-19 18:31:44 +09:00
parent 4820c9d417
commit 86cbbc6d05
15 changed files with 23 additions and 23 deletions
+1 -1
View File
@@ -151,7 +151,7 @@ int machine_id_setup(const char *root, bool force_transient, sd_id128_t machine_
}
if (writable) {
if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
if (lseek(fd, 0, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek %s: %m", etc_machine_id);
if (ftruncate(fd, 0) < 0)