diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-10-18 06:52:47 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-10-19 11:31:44 +0200 |
commit | 86cbbc6d052bc3cc97aa2ece58603a9939f9ee6a (patch) | |
tree | 6186d2df19cd787bdc5530462ee063fe8cff8cbc /src/journal-remote/journal-gatewayd.c | |
parent | fuzz: unify logging setup (diff) | |
download | systemd-86cbbc6d052bc3cc97aa2ece58603a9939f9ee6a.tar.xz systemd-86cbbc6d052bc3cc97aa2ece58603a9939f9ee6a.zip |
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.
Diffstat (limited to 'src/journal-remote/journal-gatewayd.c')
-rw-r--r-- | src/journal-remote/journal-gatewayd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index 980b98137e..09194710cb 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -233,7 +233,7 @@ static ssize_t request_reader_entries( } sz = ftello(m->tmp); - if (sz == (off_t) -1) { + if (sz < 0) { log_error_errno(errno, "Failed to retrieve file position: %m"); return MHD_CONTENT_READER_END_WITH_ERROR; } @@ -582,7 +582,7 @@ static ssize_t request_reader_fields( } sz = ftello(m->tmp); - if (sz == (off_t) -1) { + if (sz < 0) { log_error_errno(errno, "Failed to retrieve file position: %m"); return MHD_CONTENT_READER_END_WITH_ERROR; } |