diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs6rc/s6rc_livedir_prefix.c | 2 | ||||
-rw-r--r-- | src/libs6rc/s6rc_read_uint.c | 2 | ||||
-rw-r--r-- | src/s6-rc/s6-rc-compile.c | 8 | ||||
-rw-r--r-- | src/s6-rc/s6-rc-update.c | 3 | ||||
-rw-r--r-- | src/s6-rc/s6-rc.c | 3 |
5 files changed, 10 insertions, 8 deletions
diff --git a/src/libs6rc/s6rc_livedir_prefix.c b/src/libs6rc/s6rc_livedir_prefix.c index 09fe263..e28c078 100644 --- a/src/libs6rc/s6rc_livedir_prefix.c +++ b/src/libs6rc/s6rc_livedir_prefix.c @@ -13,7 +13,7 @@ ssize_t s6rc_livedir_prefix (char const *live, char *s, size_t n) memcpy(sfn, live, llen) ; memcpy(sfn + llen, "/prefix", 8) ; r = openreadnclose(sfn, s, n) ; - if (r < 0) return errno == ENOENT ? 0 : r ; + if (r == -1) return errno == ENOENT ? 0 : r ; if (memchr(s, '/', r) || memchr(s, '\n', r)) return (errno = EINVAL, -1) ; return r ; } diff --git a/src/libs6rc/s6rc_read_uint.c b/src/libs6rc/s6rc_read_uint.c index 1f148ac..c694f0d 100644 --- a/src/libs6rc/s6rc_read_uint.c +++ b/src/libs6rc/s6rc_read_uint.c @@ -11,7 +11,7 @@ int s6rc_read_uint (char const *file, unsigned int *u) { char buf[UINT_FMT + 1] ; ssize_t r = openreadnclose(file, buf, UINT_FMT) ; - if (r < 0) return (errno == ENOENT) ? 0 : -1 ; + if (r == -1) return (errno == ENOENT) ? 0 : -1 ; buf[byte_chr(buf, r, '\n')] = 0 ; if (!uint0_scan(buf, u)) return (errno = EINVAL, -1) ; return 1 ; diff --git a/src/s6-rc/s6-rc-compile.c b/src/s6-rc/s6-rc-compile.c index cf9d62b..68b80c9 100644 --- a/src/s6-rc/s6-rc-compile.c +++ b/src/s6-rc/s6-rc-compile.c @@ -366,8 +366,8 @@ static uint32_t read_timeout (int dfd, char const *srcdir, char const *name, cha { char buf[64] ; uint32_t timeout = 0 ; - size_t r = openreadnclose_at(dfd, tname, buf, 63) ; - if (!r) + ssize_t r = openreadnclose_at(dfd, tname, buf, 63) ; + if (r == -1) { if (errno && errno != ENOENT) strerr_diefu6sys(111, "read ", srcdir, "/", name, "/", tname) ; @@ -528,10 +528,10 @@ static inline void add_bundle (before_t *be, int dfd, char const *srcdir, char c static inline void add_source (before_t *be, int dfd, char const *srcdir, char const *name) { char typestr[8] = "" ; - size_t r ; + ssize_t r ; if (verbosity >= 2) strerr_warni4x("parsing ", srcdir, "/", name) ; r = openreadnclose_at(dfd, "type", typestr, 8) ; - if (!r) + if (r == -1) { if (!errno) errno = EINVAL ; strerr_diefu5sys(111, "read ", srcdir, "/", name, "/type") ; diff --git a/src/s6-rc/s6-rc-update.c b/src/s6-rc/s6-rc-update.c index 209e0f0..6f896a2 100644 --- a/src/s6-rc/s6-rc-update.c +++ b/src/s6-rc/s6-rc-update.c @@ -672,7 +672,8 @@ int main (int argc, char const *const *argv, char const *const *envp) memcpy(dbfn + livelen + 1, "state", 6) ; { ssize_t rr = openreadnclose(dbfn, (char *)oldstate, oldn) ; - if (rr != oldn) strerr_diefu2sys(111, "read ", dbfn) ; + if (rr == -1) strerr_diefu2sys(111, "read ", dbfn) ; + if (rr < oldn) strerr_diefu2x(4, "read valid db in ", dbfn) ; } r = oldn ; while (r--) oldstate[r] &= 1 ; diff --git a/src/s6-rc/s6-rc.c b/src/s6-rc/s6-rc.c index 4fedee4..d99d6aa 100644 --- a/src/s6-rc/s6-rc.c +++ b/src/s6-rc/s6-rc.c @@ -565,7 +565,8 @@ int main (int argc, char const *const *argv) memcpy(dbfn + livelen + 1, "state", 6) ; { ssize_t r = openreadnclose(dbfn, (char *)state, n) ; - if (r != n) strerr_diefu2sys(111, "read ", dbfn) ; + if (r == -1) strerr_diefu2sys(111, "read ", dbfn) ; + if (r < n) strerr_diefu2x(4, "read valid db in ", dbfn) ; { unsigned int i = n ; while (i--) state[i] &= 1 ; |