From 6305fe2580781df44e93c1ec8ed380896680960d Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 21 Jul 2018 16:42:59 +0000 Subject: Adapt to skalibs-2.7.0.0 --- src/conn-tools/s6-accessrules-cdb-from-fs.c | 5 ++--- src/daemontools-extras/s6-log.c | 13 +++++-------- src/libs6/ftrig1_free.c | 4 ++-- src/libs6/ftrig1_make.c | 18 ++++++------------ src/libs6/ftrigw_clean.c | 2 +- src/libs6/ftrigw_notifyb_nosig.c | 12 +++++------- 6 files changed, 21 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/conn-tools/s6-accessrules-cdb-from-fs.c b/src/conn-tools/s6-accessrules-cdb-from-fs.c index 9efacdb..ab61451 100644 --- a/src/conn-tools/s6-accessrules-cdb-from-fs.c +++ b/src/conn-tools/s6-accessrules-cdb-from-fs.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -20,9 +21,7 @@ static stralloc tmp = STRALLOC_ZERO ; static void cleanup (void) { - int e = errno ; - unlink(tmp.s) ; - errno = e ; + unlink_void(tmp.s) ; } static void dienomem (void) diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c index 10d78f3..04cfe8c 100644 --- a/src/daemontools-extras/s6-log.c +++ b/src/daemontools-extras/s6-log.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -215,9 +216,7 @@ static inline int logdir_trim (logdir_t *ldp) } if (errno) { - int e = errno ; dir_close(dir) ; - errno = e ; return -1 ; } rewinddir(dir) ; @@ -252,9 +251,7 @@ static inline int logdir_trim (logdir_t *ldp) } if (errno) { - int e = errno ; dir_close(dir) ; - errno = e ; return -1 ; } dir_close(dir) ; @@ -586,9 +583,9 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint } else if (st.st_mode & S_IXUSR) goto opencurrent ; memcpy(x + dirlen + 1, "state", 6) ; - unlink(x) ; + unlink_void(x) ; memcpy(x + dirlen + 1, "newstate", 9) ; - unlink(x) ; + unlink_void(x) ; { int flagprocessed = 0 ; memcpy(x + dirlen + 1, "processed", 10) ; @@ -600,13 +597,13 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint if (flagprocessed) { memcpy(x + dirlen + 1, "previous", 9) ; - unlink(x) ; + unlink_void(x) ; if (finish(ldp, "processed", 's') < 0) strerr_diefu2sys(111, "finish processed .s for logdir ", ldp->dir) ; } else { - unlink(x) ; + unlink_void(x) ; if (finish(ldp, "previous", 'u') < 0) strerr_diefu2sys(111, "finish previous .u for logdir ", ldp->dir) ; } diff --git a/src/libs6/ftrig1_free.c b/src/libs6/ftrig1_free.c index 091dc87..61c0d1d 100644 --- a/src/libs6/ftrig1_free.c +++ b/src/libs6/ftrig1_free.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include +#include #include #include #include "ftrig1.h" @@ -9,7 +9,7 @@ void ftrig1_free (ftrig1_t *p) { if (p->name.s) { - unlink(p->name.s) ; + unlink_void(p->name.s) ; stralloc_free(&p->name) ; } if (p->fd >= 0) diff --git a/src/libs6/ftrig1_make.c b/src/libs6/ftrig1_make.c index 8cac6b2..8f6d985 100644 --- a/src/libs6/ftrig1_make.c +++ b/src/libs6/ftrig1_make.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,6 @@ int ftrig1_make (ftrig1_t *f, char const *path) { ftrig1_t ff = FTRIG1_ZERO ; size_t pathlen = strlen(path) ; - int e = 0 ; char tmp[pathlen + 46 + FTRIG1_PREFIXLEN] ; memcpy(tmp, path, pathlen) ; @@ -54,28 +53,23 @@ int ftrig1_make (ftrig1_t *f, char const *path) umask(m) ; } - if (!stralloc_catb(&ff.name, tmp, pathlen+1)) { e = errno ; goto err0 ; } - if (!stralloc_catb(&ff.name, tmp + pathlen + 2, FTRIG1_PREFIXLEN + 44)) - { - e = errno ; goto err1 ; - } + if (!stralloc_catb(&ff.name, tmp, pathlen+1)) goto err0 ; + if (!stralloc_catb(&ff.name, tmp + pathlen + 2, FTRIG1_PREFIXLEN + 44)) goto err1 ; ff.fd = open_read(tmp) ; - if (ff.fd == -1) { e = errno ; goto err1 ; } + if (ff.fd == -1) goto err1 ; ff.fdw = open_write(tmp) ; - if (ff.fdw == -1) { e = errno ; goto err2 ; } + if (ff.fdw == -1) goto err2 ; if (rename(tmp, ff.name.s) == -1) goto err3 ; *f = ff ; return 1 ; err3: - e = errno ; fd_close(ff.fdw) ; err2: fd_close(ff.fd) ; err1: stralloc_free(&ff.name) ; err0: - unlink(tmp) ; - errno = e ; + unlink_void(tmp) ; return 0 ; } diff --git a/src/libs6/ftrigw_clean.c b/src/libs6/ftrigw_clean.c index 3253f7a..3ad9e3a 100644 --- a/src/libs6/ftrigw_clean.c +++ b/src/libs6/ftrigw_clean.c @@ -33,7 +33,7 @@ int ftrigw_clean (char const *path) else if ((errno == ENXIO) && (unlink(tmp) < 0)) e = errno ; } } - if (errno) e = errno ; dir_close(dir) ; + if (errno) e = errno ; return e ? (errno = e, 0) : 1 ; } diff --git a/src/libs6/ftrigw_notifyb_nosig.c b/src/libs6/ftrigw_notifyb_nosig.c index 0ba38a6..38110f2 100644 --- a/src/libs6/ftrigw_notifyb_nosig.c +++ b/src/libs6/ftrigw_notifyb_nosig.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -32,14 +33,14 @@ int ftrigw_notifyb_nosig (char const *path, char const *s, size_t len) fd = open_write(tmp) ; if (fd == -1) { - if (errno == ENXIO) unlink(tmp) ; + if (errno == ENXIO) unlink_void(tmp) ; } else { ssize_t r = fd_write(fd, s, len) ; if ((r < 0) || (size_t)r < len) { - if (errno == EPIPE) unlink(tmp) ; + if (errno == EPIPE) unlink_void(tmp) ; /* what to do if EGAIN ? full fifo -> fix the reader ! There's a race condition in extreme cases though ; but it's still better to be nonblocking - the writer @@ -54,9 +55,6 @@ int ftrigw_notifyb_nosig (char const *path, char const *s, size_t len) } } } - { - int e = errno ; - dir_close(dir) ; - return e ? (errno = e, -1) : (int)i ; - } + dir_close(dir) ; + return errno ? -1 : (int)i ; } -- cgit v1.2.3