summaryrefslogtreecommitdiff
path: root/src/daemontools-extras
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-03-12 11:59:43 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-03-12 11:59:43 +0000
commitc60ebd422171808ad58b936914055397bb205bef (patch)
tree7db3e5728d72ad209f8e22b9eb9f337e0b0c3e58 /src/daemontools-extras
parente28fe5908a91d8795ca9923d64eeed7d3e898434 (diff)
downloads6-c60ebd422171808ad58b936914055397bb205bef.tar.xz
Adapt to skalibs-2.5.0.0
Diffstat (limited to 'src/daemontools-extras')
-rw-r--r--src/daemontools-extras/s6-applyuidgid.c19
-rw-r--r--src/daemontools-extras/s6-envdir.c2
-rw-r--r--src/daemontools-extras/s6-envuidgid.c39
-rw-r--r--src/daemontools-extras/s6-fghack.c1
-rw-r--r--src/daemontools-extras/s6-log.c140
-rw-r--r--src/daemontools-extras/s6-setlock.c7
-rw-r--r--src/daemontools-extras/s6-setsid.c4
-rw-r--r--src/daemontools-extras/s6-setuidgid.c13
-rw-r--r--src/daemontools-extras/s6-softlimit.c2
-rw-r--r--src/daemontools-extras/s6-tai64n.c7
-rw-r--r--src/daemontools-extras/s6-tai64nlocal.c6
-rw-r--r--src/daemontools-extras/ucspilogd.c8
12 files changed, 119 insertions, 129 deletions
diff --git a/src/daemontools-extras/s6-applyuidgid.c b/src/daemontools-extras/s6-applyuidgid.c
index b80564f..a770b2a 100644
--- a/src/daemontools-extras/s6-applyuidgid.c
+++ b/src/daemontools-extras/s6-applyuidgid.c
@@ -1,12 +1,10 @@
/* ISC license. */
#include <skalibs/nonposix.h>
-#include <sys/types.h>
#include <unistd.h>
#include <grp.h>
#include <limits.h>
-#include <skalibs/uint64.h>
-#include <skalibs/gidstuff.h>
+#include <skalibs/types.h>
#include <skalibs/setgroups.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
@@ -18,29 +16,29 @@
int main (int argc, char const *const *argv, char const *const *envp)
{
- uint64 uid = 0 ;
+ uid_t uid = 0 ;
gid_t gid = 0 ;
gid_t gids[NGROUPS_MAX] ;
- unsigned int gidn = (unsigned int)-1 ;
+ size_t gidn = (size_t)-1 ;
int unexport = 0 ;
PROG = "s6-applyuidgid" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "zUu:g:G:", &l) ;
+ int opt = subgetopt_r(argc, argv, "zUu:g:G:", &l) ;
if (opt == -1) break ;
switch (opt)
{
case 'z' : unexport = 1 ; break ;
- case 'u' : if (!uint640_scan(l.arg, &uid)) dieusage() ; break ;
+ case 'u' : if (!uid0_scan(l.arg, &uid)) dieusage() ; break ;
case 'g' : if (!gid0_scan(l.arg, &gid)) dieusage() ; break ;
case 'G' : if (!gid_scanlist(gids, NGROUPS_MAX, l.arg, &gidn) && *l.arg) dieusage() ; break ;
case 'U' :
{
char const *x = env_get2(envp, "UID") ;
if (!x) strerr_dienotset(100, "UID") ;
- if (!uint640_scan(x, &uid)) strerr_dieinvalid(100, "UID") ;
+ if (!uid0_scan(x, &uid)) strerr_dieinvalid(100, "UID") ;
x = env_get2(envp, "GID") ;
if (!x) strerr_dienotset(100, "GID") ;
if (!gid0_scan(x, &gid)) strerr_dieinvalid(100, "GID") ;
@@ -57,12 +55,11 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
if (!argc) dieusage() ;
- if (uid > (uint64)(uid_t)-1) strerr_dief1x(100, "uid value too big") ;
- if (gidn != (unsigned int)-1 && setgroups(gidn, gids) < 0)
+ if (gidn != (size_t)-1 && setgroups(gidn, gids) < 0)
strerr_diefu1sys(111, "set supplementary group list") ;
if (gid && setgid(gid) < 0)
strerr_diefu1sys(111, "setgid") ;
- if (uid && setuid((uid_t)uid) < 0)
+ if (uid && setuid(uid) < 0)
strerr_diefu1sys(111, "setuid") ;
if (unexport) pathexec_r(argv, envp, env_len(envp), "UID\0GID\0GIDLIST", 16) ;
diff --git a/src/daemontools-extras/s6-envdir.c b/src/daemontools-extras/s6-envdir.c
index 394253e..431389b 100644
--- a/src/daemontools-extras/s6-envdir.c
+++ b/src/daemontools-extras/s6-envdir.c
@@ -19,7 +19,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
PROG = "s6-envdir" ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "Iinfc:", &l) ;
+ int opt = subgetopt_r(argc, argv, "Iinfc:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/daemontools-extras/s6-envuidgid.c b/src/daemontools-extras/s6-envuidgid.c
index 365a862..d808219 100644
--- a/src/daemontools-extras/s6-envuidgid.c
+++ b/src/daemontools-extras/s6-envuidgid.c
@@ -1,24 +1,21 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <pwd.h>
#include <grp.h>
#include <limits.h>
-#include <skalibs/uint64.h>
-#include <skalibs/gidstuff.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/env.h>
-#include <skalibs/fmtscan.h>
#include <skalibs/djbunix.h>
#define USAGE "s6-envuidgid [ -i | -D defaultuid:defaultgid ] [ -u | -g | -B ] [ -n ] account prog..."
#define dieusage() strerr_dieusage(100, USAGE)
-static inline size_t scan_defaults (char const *s, uint64 *uid, gid_t *gid, unsigned int *n, gid_t *tab)
+static inline size_t scan_defaults (char const *s, uid_t *uid, gid_t *gid, size_t *n, gid_t *tab)
{
- size_t pos = uint64_scan(s, uid) ;
+ size_t pos = uid_scan(s, uid) ;
if (!pos)
{
if (*s != ':') return 0 ;
@@ -54,16 +51,16 @@ int main (int argc, char *const *argv, char const *const *envp)
unsigned int what = 7 ;
int numfallback = 0 ;
int insist = 1 ;
- uint64 uid ;
+ uid_t uid ;
gid_t gid ;
- unsigned int n ;
+ size_t n ;
gid_t tab[NGROUPS_MAX] ;
PROG = "s6-envuidgid" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, (char const *const *)argv, "ugBniD:", &l) ;
+ int opt = subgetopt_r(argc, (char const *const *)argv, "ugBniD:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -94,13 +91,13 @@ int main (int argc, char *const *argv, char const *const *envp)
break ;
case 3 : /* both */
{
- size_t pos = str_chr(argv[0], ':') ;
+ char *colon = strchr(argv[0], ':') ;
user = argv[0] ;
- if (argv[0][pos])
+ if (colon)
{
- argv[0][pos] = 0 ;
- group = argv[0] + pos + 1 ;
- if (!pos) user = 0 ;
+ *colon = 0 ;
+ group = colon + 1 ;
+ if (colon == argv[0]) user = 0 ;
if (!group[0]) group = 0 ;
}
break ;
@@ -131,28 +128,28 @@ int main (int argc, char *const *argv, char const *const *envp)
gid = pw->pw_gid ;
}
}
- else if (numfallback && uint64_scan(user, &uid)) ;
+ else if (numfallback && uid_scan(user, &uid)) ;
else if (insist) strerr_dief2x(1, "unknown user: ", user) ;
}
{
size_t pos = 0 ;
- char fmt[19 + UINT64_FMT + (NGROUPS_MAX+1) * GID_FMT] ;
+ char fmt[19 + UID_FMT + (NGROUPS_MAX+1) * GID_FMT] ;
if (what & 1)
{
- byte_copy(fmt + pos, 4, "UID=") ; pos += 4 ;
- pos += uint64_fmt(fmt + pos, uid) ;
+ memcpy(fmt + pos, "UID=", 4) ; pos += 4 ;
+ pos += uid_fmt(fmt + pos, uid) ;
fmt[pos++] = 0 ;
}
if (what & 2)
{
- byte_copy(fmt + pos, 4, "GID=") ; pos += 4 ;
+ memcpy(fmt + pos, "GID=", 4) ; pos += 4 ;
pos += gid_fmt(fmt + pos, gid) ;
fmt[pos++] = 0 ;
}
if (what & 4)
{
- byte_copy(fmt + pos, 8, "GIDLIST=") ; pos += 8 ;
+ memcpy(fmt + pos, "GIDLIST=", 8) ; pos += 8 ;
pos += gid_fmtlist(fmt + pos, tab, n) ;
fmt[pos++] = 0 ;
}
diff --git a/src/daemontools-extras/s6-fghack.c b/src/daemontools-extras/s6-fghack.c
index 1415706..5981b96 100644
--- a/src/daemontools-extras/s6-fghack.c
+++ b/src/daemontools-extras/s6-fghack.c
@@ -1,6 +1,5 @@
/* ISC license. */
-#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <sys/wait.h>
diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c
index 0fdbf68..bdc0a82 100644
--- a/src/daemontools-extras/s6-log.c
+++ b/src/daemontools-extras/s6-log.c
@@ -1,17 +1,17 @@
/* ISC license. */
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
+#include <stdint.h>
+#include <string.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <regex.h>
-#include <skalibs/uint32.h>
#include <skalibs/uint64.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/buffer.h>
#include <skalibs/bytestr.h>
@@ -141,11 +141,11 @@ struct logdir_s
unsigned int xindex ;
tain_t retrytto ;
tain_t deadline ;
- uint64 maxdirsize ;
- uint32 b ;
- uint32 n ;
- uint32 s ;
- uint32 tolerance ;
+ uint64_t maxdirsize ;
+ uint32_t b ;
+ uint32_t n ;
+ uint32_t s ;
+ uint32_t tolerance ;
pid_t pid ;
char const *dir ;
char const *processor ;
@@ -188,13 +188,13 @@ static unsigned int llen = 0 ;
static int filesize_cmp (filesize_t const *a, filesize_t const *b)
{
- return byte_diff(a->name+1, 26, b->name+1) ;
+ return memcmp(a->name+1, b->name+1, 26) ;
}
static int name_is_relevant (char const *name)
{
tain_t dummy ;
- if (str_len(name) != 27) return 0 ;
+ if (strlen(name) != 27) return 0 ;
if (!timestamp_scan(name, &dummy)) return 0 ;
if (name[25] != '.') return 0 ;
if ((name[26] != 's') && (name[26] != 'u')) return 0 ;
@@ -216,7 +216,7 @@ static inline int logdir_trim (logdir_t *ldp)
}
if (errno)
{
- register int e = errno ;
+ int e = errno ;
dir_close(dir) ;
errno = e ;
return -1 ;
@@ -224,12 +224,12 @@ static inline int logdir_trim (logdir_t *ldp)
rewinddir(dir) ;
if (n)
{
- uint64 totalsize = 0 ;
- size_t dirlen = str_len(ldp->dir) ;
+ uint64_t totalsize = 0 ;
+ size_t dirlen = strlen(ldp->dir) ;
unsigned int i = 0 ;
filesize_t blurgh[n] ;
char fullname[dirlen + 29] ;
- byte_copy(fullname, dirlen, ldp->dir) ;
+ memcpy(fullname, ldp->dir, dirlen) ;
fullname[dirlen] = '/' ;
for (;;)
{
@@ -240,20 +240,20 @@ static inline int logdir_trim (logdir_t *ldp)
if (!d) break ;
if (!name_is_relevant(d->d_name)) continue ;
if (i >= n) { errno = EBUSY ; break ; }
- byte_copy(fullname + dirlen + 1, 28, d->d_name) ;
+ memcpy(fullname + dirlen + 1, d->d_name, 28) ;
if (stat(fullname, &st) < 0)
{
if (verbosity) strerr_warnwu2sys("stat ", fullname) ;
continue ;
}
- byte_copy(blurgh[i].name, 28, d->d_name) ;
+ memcpy(blurgh[i].name, d->d_name, 28) ;
blurgh[i].size = st.st_size ;
totalsize += st.st_size ;
i++ ;
}
if (errno)
{
- register int e = errno ;
+ int e = errno ;
dir_close(dir) ;
errno = e ;
return -1 ;
@@ -265,7 +265,7 @@ static inline int logdir_trim (logdir_t *ldp)
n = 0 ;
while ((i > ldp->n + n) || (ldp->maxdirsize && (totalsize > ldp->maxdirsize)))
{
- byte_copy(fullname + dirlen + 1, 28, blurgh[n].name) ;
+ memcpy(fullname + dirlen + 1, blurgh[n].name, 28) ;
if (unlink(fullname) < 0)
{
if (errno == ENOENT) totalsize -= blurgh[n].size ;
@@ -281,17 +281,17 @@ static inline int logdir_trim (logdir_t *ldp)
static int finish (logdir_t *ldp, char const *name, char suffix)
{
struct stat st ;
- size_t dirlen = str_len(ldp->dir) ;
- size_t namelen = str_len(name) ;
+ size_t dirlen = strlen(ldp->dir) ;
+ size_t namelen = strlen(name) ;
char x[dirlen + namelen + 2] ;
- byte_copy(x, dirlen, ldp->dir) ;
+ memcpy(x, ldp->dir, dirlen) ;
x[dirlen] = '/' ;
- byte_copy(x + dirlen + 1, namelen + 1, name) ;
+ memcpy(x + dirlen + 1, name, namelen + 1) ;
if (stat(x, &st) < 0) return errno == ENOENT ? 0 : -1 ;
if (st.st_nlink == 1)
{
char y[dirlen + 29] ;
- byte_copy(y, dirlen, ldp->dir) ;
+ memcpy(y, ldp->dir, dirlen) ;
y[dirlen] = '/' ;
timestamp_g(y + dirlen + 1) ;
y[dirlen + 26] = '.' ;
@@ -329,7 +329,7 @@ static inline void exec_processor (logdir_t *ldp)
static int rotator (logdir_t *ldp)
{
- size_t dirlen = str_len(ldp->dir) ;
+ size_t dirlen = strlen(ldp->dir) ;
switch (ldp->rstate)
{
case ROTSTATE_START :
@@ -344,10 +344,10 @@ static int rotator (logdir_t *ldp)
{
char current[dirlen + 9] ;
char previous[dirlen + 10] ;
- byte_copy(current, dirlen, ldp->dir) ;
- byte_copy(current + dirlen, 9, "/current") ;
- byte_copy(previous, dirlen, ldp->dir) ;
- byte_copy(previous + dirlen, 10, "/previous") ;
+ memcpy(current, ldp->dir, dirlen) ;
+ memcpy(current + dirlen, "/current", 9) ;
+ memcpy(previous, ldp->dir, dirlen) ;
+ memcpy(previous + dirlen, "/previous", 10) ;
if (rename(current, previous) < 0)
{
if (verbosity) strerr_warnwu4sys("rename ", current, " to ", previous) ;
@@ -359,8 +359,8 @@ static int rotator (logdir_t *ldp)
{
int fd ;
char x[dirlen + 9] ;
- byte_copy(x, dirlen, ldp->dir) ;
- byte_copy(x + dirlen, 9, "/current") ;
+ memcpy(x, ldp->dir, dirlen) ;
+ memcpy(x + dirlen, "/current", 9) ;
fd = open_append(x) ;
if (fd < 0)
{
@@ -369,7 +369,7 @@ static int rotator (logdir_t *ldp)
}
if (coe(fd) < 0)
{
- register int e = errno ;
+ int e = errno ;
fd_close(fd) ;
errno = e ;
if (verbosity) strerr_warnwu2sys("coe ", x) ;
@@ -377,7 +377,7 @@ static int rotator (logdir_t *ldp)
}
if (fd_chmod(fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) < 0)
{
- register int e = errno ;
+ int e = errno ;
fd_close(fd) ;
errno = e ;
if (verbosity) strerr_warnwu3sys("fchmod ", x, " to 0644") ;
@@ -391,8 +391,8 @@ static int rotator (logdir_t *ldp)
case ROTSTATE_CHMODPREVIOUS :
{
char x[dirlen + 10] ;
- byte_copy(x, dirlen, ldp->dir) ;
- byte_copy(x + dirlen, 10, "/previous") ;
+ memcpy(x, ldp->dir, dirlen) ;
+ memcpy(x + dirlen, "/previous", 10) ;
if (chmod(x, S_IRWXU | S_IRGRP | S_IROTH) < 0)
{
if (verbosity) strerr_warnwu3sys("chmod ", x, " to 0744") ;
@@ -431,8 +431,8 @@ static int rotator (logdir_t *ldp)
{
int fd ;
char x[dirlen + 11] ;
- byte_copy(x, dirlen, ldp->dir) ;
- byte_copy(x + dirlen, 11, "/processed") ;
+ memcpy(x, ldp->dir, dirlen) ;
+ memcpy(x + dirlen, "/processed", 11) ;
fd = open_append(x) ;
if (fd < 0)
{
@@ -441,7 +441,7 @@ static int rotator (logdir_t *ldp)
}
if (fd_sync(fd) < 0)
{
- register int e = errno ;
+ int e = errno ;
fd_close(fd) ;
errno = e ;
if (verbosity) strerr_warnwu2sys("fd_sync ", x) ;
@@ -450,7 +450,7 @@ static int rotator (logdir_t *ldp)
tain_now_g() ;
if (fd_chmod(fd, S_IRWXU | S_IRGRP | S_IROTH) < 0)
{
- register int e = errno ;
+ int e = errno ;
fd_close(fd) ;
errno = e ;
if (verbosity) strerr_warnwu3sys("fd_chmod ", x, " to 0744") ;
@@ -463,8 +463,8 @@ static int rotator (logdir_t *ldp)
{
int fd ;
char x[dirlen + 10] ;
- byte_copy(x, dirlen, ldp->dir) ;
- byte_copy(x + dirlen, 10, "/newstate") ;
+ memcpy(x, ldp->dir, dirlen) ;
+ memcpy(x + dirlen, "/newstate", 10) ;
fd = open_append(x) ;
if (fd < 0)
{
@@ -483,8 +483,8 @@ static int rotator (logdir_t *ldp)
case ROTSTATE_UNLINKPREVIOUS :
{
char x[dirlen + 10] ;
- byte_copy(x, dirlen, ldp->dir) ;
- byte_copy(x + dirlen, 10, "/previous") ;
+ memcpy(x, ldp->dir, dirlen) ;
+ memcpy(x + dirlen, "/previous", 10) ;
if ((unlink(x) < 0) && (errno != ENOENT))
{
if (verbosity) strerr_warnwu2sys("open_append ", x) ;
@@ -496,10 +496,10 @@ static int rotator (logdir_t *ldp)
{
char newstate[dirlen + 10] ;
char state[dirlen + 7] ;
- byte_copy(newstate, dirlen, ldp->dir) ;
- byte_copy(state, dirlen, ldp->dir) ;
- byte_copy(newstate + dirlen, 10, "/newstate") ;
- byte_copy(state + dirlen, 7, "/state") ;
+ memcpy(newstate, ldp->dir, dirlen) ;
+ memcpy(state, ldp->dir, dirlen) ;
+ memcpy(newstate + dirlen, "/newstate", 10) ;
+ memcpy(state + dirlen, "/state", 7) ;
if (rename(newstate, state) < 0)
{
if (verbosity) strerr_warnwu4sys("rename ", newstate, " to ", state) ;
@@ -524,7 +524,7 @@ static int rotator (logdir_t *ldp)
return 0 ;
}
-static int logdir_write (int i, char const *s, size_t len)
+static ssize_t logdir_write (int i, char const *s, size_t len)
{
logdir_t *ldp = logdirs + i ;
ssize_t r ;
@@ -563,7 +563,7 @@ static inline void rotate_or_flush (logdir_t *ldp)
bufalloc_flush(&ldp->out) ;
}
-static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint32_t tolerance, uint64 maxdirsize, tain_t const *retrytto, char const *processor, char const *name, unsigned int flags)
+static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint32_t tolerance, uint64_t maxdirsize, tain_t const *retrytto, char const *processor, char const *name, unsigned int flags)
{
logdir_t *ldp = logdirs + index ;
struct stat st ;
@@ -583,25 +583,25 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint
ldp->rstate = ROTSTATE_WRITABLE ;
r = mkdir(ldp->dir, S_IRWXU | S_ISGID) ;
if ((r < 0) && (errno != EEXIST)) strerr_diefu2sys(111, "mkdir ", name) ;
- byte_copy(x, dirlen, name) ;
- byte_copy(x + dirlen, 6, "/lock") ;
+ memcpy(x, name, dirlen) ;
+ memcpy(x + dirlen, "/lock", 6) ;
ldp->fdlock = open_append(x) ;
if ((ldp->fdlock) < 0) strerr_diefu2sys(111, "open_append ", x) ;
if (lock_exnb(ldp->fdlock) < 0) strerr_diefu2sys(111, "lock_exnb ", x) ;
if (coe(ldp->fdlock) < 0) strerr_diefu2sys(111, "coe ", x) ;
- byte_copy(x + dirlen + 1, 8, "current") ;
+ memcpy(x + dirlen + 1, "current", 8) ;
if (stat(x, &st) < 0)
{
if (errno != ENOENT) strerr_diefu2sys(111, "stat ", x) ;
}
else if (st.st_mode & S_IXUSR) goto opencurrent ;
- byte_copy(x + dirlen + 1, 6, "state") ;
+ memcpy(x + dirlen + 1, "state", 6) ;
unlink(x) ;
- byte_copy(x + dirlen + 1, 9, "newstate") ;
+ memcpy(x + dirlen + 1, "newstate", 9) ;
unlink(x) ;
{
int flagprocessed = 0 ;
- byte_copy(x + dirlen + 1, 10, "processed") ;
+ memcpy(x + dirlen + 1, "processed", 10) ;
if (stat(x, &st) < 0)
{
if (errno != ENOENT) strerr_diefu2sys(111, "stat ", x) ;
@@ -609,7 +609,7 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint
else if (st.st_mode & S_IXUSR) flagprocessed = 1 ;
if (flagprocessed)
{
- byte_copy(x + dirlen + 1, 9, "previous") ;
+ memcpy(x + dirlen + 1, "previous", 9) ;
unlink(x) ;
if (finish(ldp, "processed", 's') < 0)
strerr_diefu2sys(111, "finish processed .s for logdir ", ldp->dir) ;
@@ -623,12 +623,12 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint
}
if (finish(ldp, "current", 'u') < 0)
strerr_diefu2sys(111, "finish current .u for logdir ", ldp->dir) ;
- byte_copy(x + dirlen + 1, 6, "state") ;
+ memcpy(x + dirlen + 1, "state", 6) ;
ldp->fd = open_trunc(x) ;
if (ldp->fd < 0) strerr_diefu2sys(111, "open_trunc ", x) ;
fd_close(ldp->fd) ;
st.st_size = 0 ;
- byte_copy(x + dirlen + 1, 8, "current") ;
+ memcpy(x + dirlen + 1, "current", 8) ;
opencurrent:
ldp->fd = open_append(x) ;
if (ldp->fd < 0) strerr_diefu2sys(111, "open_append ", x) ;
@@ -779,7 +779,7 @@ static inline void script_secondpass (char const *const *argv, scriptelem_t *scr
uint32_t s = 99999 ;
uint32_t n = 10 ;
uint32_t tolerance = 2000 ;
- uint64 maxdirsize = 0 ;
+ uint64_t maxdirsize = 0 ;
char const *processor = 0 ;
unsigned int sel = 0, act = 0, lidx = 0, flags = 0 ;
int flagacted = 0 ;
@@ -948,7 +948,7 @@ static void script_run (scriptelem_t const *script, unsigned int scriptlen, char
for (j = 0 ; j < script[i].actlen ; j++)
{
act_t const *act = script[i].acts + j ;
- siovec_t v[4] = { { .s = tstamp, .len = act->flags & 1 ? TIMESTAMP+1 : 0 }, { .s = hstamp, .len = act->flags & 2 ? hlen : 0 }, { .s = (char *)s, .len = len }, { .s = "\n", .len = 1 } } ;
+ struct iovec v[4] = { { .iov_base = tstamp, .iov_len = act->flags & 1 ? TIMESTAMP+1 : 0 }, { .iov_base = hstamp, .iov_len = act->flags & 2 ? hlen : 0 }, { .iov_base = (char *)s, .iov_len = len }, { .iov_base = "\n", .iov_len = 1 } } ;
switch (act->type)
{
case ACTTYPE_FD1 :
@@ -961,9 +961,9 @@ static void script_run (scriptelem_t const *script, unsigned int scriptlen, char
buffer_puts(buffer_2, ": alert: ") ;
if (act->data.fd2_size && act->data.fd2_size + 3 < len)
{
- v[2].len = act->data.fd2_size ;
- v[3].s = "...\n" ;
- v[3].len = 4 ;
+ v[2].iov_len = act->data.fd2_size ;
+ v[3].iov_base = "...\n" ;
+ v[3].iov_len = 4 ;
}
buffer_putv(buffer_2, v, 4) ;
buffer_flush(buffer_2) ; /* if it blocks, too bad */
@@ -977,10 +977,10 @@ static void script_run (scriptelem_t const *script, unsigned int scriptlen, char
siovec_trunc(v, 4, act->data.status.filelen) ;
else
{
- register size_t k = act->data.status.filelen - reallen + 1 ;
+ size_t k = act->data.status.filelen - reallen + 1 ;
char pad[k] ;
- v[3].s = pad ;
- v[3].len = k ;
+ v[3].iov_base = pad ;
+ v[3].iov_len = k ;
while (k--) pad[k] = '\n' ;
if (!openwritevnclose_suffix(act->data.status.file, v, 4, ".new") && verbosity)
strerr_warnwu2sys("write status file ", act->data.status.file) ;
@@ -1115,8 +1115,8 @@ static inline void handle_signals (void)
case 0 : return ;
case SIGALRM :
{
- register unsigned int i = 0 ;
- for (i = 0 ; i < llen ; i++)
+ unsigned int i = 0 ;
+ for (; i < llen ; i++)
if ((logdirs[i].rstate == ROTSTATE_WRITABLE) && logdirs[i].b)
{
logdirs[i].rstate = ROTSTATE_START ;
@@ -1135,8 +1135,8 @@ static inline void handle_signals (void)
for (;;)
{
int wstat ;
- register unsigned int i = 0 ;
- register pid_t r = wait_nohang(&wstat) ;
+ unsigned int i = 0 ;
+ pid_t r = wait_nohang(&wstat) ;
if (r <= 0) break ;
for (; i < llen ; i++) if (r == logdirs[i].pid) break ;
if (i < llen) processor_died(logdirs + i, wstat) ;
@@ -1161,7 +1161,7 @@ int main (int argc, char const *const *argv)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "qvbptel:", &l) ;
+ int opt = subgetopt_r(argc, argv, "qvbptel:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/daemontools-extras/s6-setlock.c b/src/daemontools-extras/s6-setlock.c
index 27b6b23..a90bb13 100644
--- a/src/daemontools-extras/s6-setlock.c
+++ b/src/daemontools-extras/s6-setlock.c
@@ -1,13 +1,12 @@
/* ISC license. */
-#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
#include <skalibs/djbunix.h>
@@ -28,7 +27,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
PROG = "s6-setlock" ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "nNrwt:") ;
+ int opt = subgetopt(argc, argv, "nNrwt:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -68,7 +67,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
for (;;)
{
ssize_t rr ;
- register int r = iopause_g(&x, 1, &deadline) ;
+ int r = iopause_g(&x, 1, &deadline) ;
if (r < 0) strerr_diefu1sys(111, "iopause") ;
if (!r)
{
diff --git a/src/daemontools-extras/s6-setsid.c b/src/daemontools-extras/s6-setsid.c
index 609b041..0e30559 100644
--- a/src/daemontools-extras/s6-setsid.c
+++ b/src/daemontools-extras/s6-setsid.c
@@ -2,7 +2,7 @@
#include <unistd.h>
#include <signal.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/sig.h>
@@ -19,7 +19,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "sbfgiIqd:", &l) ;
+ int opt = subgetopt_r(argc, argv, "sbfgiIqd:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/daemontools-extras/s6-setuidgid.c b/src/daemontools-extras/s6-setuidgid.c
index 727696a..1893883 100644
--- a/src/daemontools-extras/s6-setuidgid.c
+++ b/src/daemontools-extras/s6-setuidgid.c
@@ -1,7 +1,6 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
#include <s6/config.h>
@@ -12,20 +11,20 @@
int main (int argc, char *const *argv, char const *const *envp)
{
char const *newargv[argc + 7] ;
- size_t pos ;
+ char *colon ;
unsigned int m = 0 ;
PROG = "s6-setuidgid" ;
if (argc < 3) dieusage() ;
argv++ ;
- pos = str_chr(argv[0], ':') ;
- if (argv[0][pos])
+ colon = strchr(argv[0], ':') ;
+ if (colon)
{
- argv[0][pos] = 0 ;
+ *colon = 0 ;
newargv[m++] = S6_BINPREFIX "s6-applyuidgid" ;
newargv[m++] = "-u" ;
newargv[m++] = argv[0] ;
newargv[m++] = "-g" ;
- newargv[m++] = argv[0] + pos + 1 ;
+ newargv[m++] = colon + 1 ;
newargv[m++] = "-G" ;
newargv[m++] = "" ;
argv++ ;
diff --git a/src/daemontools-extras/s6-softlimit.c b/src/daemontools-extras/s6-softlimit.c
index 6ddd779..7de9f3d 100644
--- a/src/daemontools-extras/s6-softlimit.c
+++ b/src/daemontools-extras/s6-softlimit.c
@@ -30,7 +30,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
PROG = "s6-softlimit" ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "a:c:d:f:l:m:o:p:r:s:t:", &l) ;
+ int opt = subgetopt_r(argc, argv, "a:c:d:f:l:m:o:p:r:s:t:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/daemontools-extras/s6-tai64n.c b/src/daemontools-extras/s6-tai64n.c
index 085c053..c6b2859 100644
--- a/src/daemontools-extras/s6-tai64n.c
+++ b/src/daemontools-extras/s6-tai64n.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <errno.h>
#include <skalibs/buffer.h>
#include <skalibs/strerr2.h>
@@ -14,7 +15,7 @@ int main (void)
stamp[TIMESTAMP] = ' ' ;
for (;;)
{
- register int r = skagetln(buffer_0f1, &satmp, '\n') ;
+ int r = skagetln(buffer_0f1, &satmp, '\n') ;
if (r < 0)
if (errno != EPIPE)
strerr_diefu1sys(111, "read from stdin") ;
@@ -26,8 +27,8 @@ int main (void)
}
else if (!r) break ;
timestamp(stamp) ;
- if ((buffer_put(buffer_1, stamp, TIMESTAMP+1) < 0)
- || (buffer_put(buffer_1, satmp.s, satmp.len) < 0))
+ if ((buffer_put(buffer_1, stamp, TIMESTAMP+1) < TIMESTAMP+1)
+ || (buffer_put(buffer_1, satmp.s, satmp.len) < (ssize_t)satmp.len))
strerr_diefu1sys(111, "write to stdout") ;
satmp.len = 0 ;
}
diff --git a/src/daemontools-extras/s6-tai64nlocal.c b/src/daemontools-extras/s6-tai64nlocal.c
index 84e717a..ce97470 100644
--- a/src/daemontools-extras/s6-tai64nlocal.c
+++ b/src/daemontools-extras/s6-tai64nlocal.c
@@ -2,8 +2,6 @@
#include <sys/types.h>
#include <errno.h>
-#include <skalibs/allreadwrite.h>
-#include <skalibs/fmtscan.h>
#include <skalibs/buffer.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
@@ -34,11 +32,11 @@ int main (void)
size_t len ;
localtmn_from_tain(&local, &a, 1) ;
len = localtmn_fmt(fmt, &local) ;
- if (buffer_put(buffer_1, fmt, len) < 0)
+ if (buffer_put(buffer_1, fmt, len) < (ssize_t)len)
strerr_diefu1sys(111, "write to stdout") ;
}
}
- if (buffer_put(buffer_1, satmp.s + p, satmp.len - p) < 0)
+ if (buffer_put(buffer_1, satmp.s + p, satmp.len - p) < (ssize_t)(satmp.len - p))
strerr_diefu1sys(111, "write to stdout") ;
satmp.len = 0 ;
}
diff --git a/src/daemontools-extras/ucspilogd.c b/src/daemontools-extras/ucspilogd.c
index 1f338bd..25e8371 100644
--- a/src/daemontools-extras/ucspilogd.c
+++ b/src/daemontools-extras/ucspilogd.c
@@ -10,7 +10,7 @@
#include <errno.h>
#include <stdlib.h>
#include <syslog.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/bytestr.h>
#include <skalibs/buffer.h>
@@ -138,7 +138,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "D:", &l) ;
+ int opt = subgetopt_r(argc, argv, "D:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -162,7 +162,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
size_t pos = 0 ;
satmp.len = 0 ;
{
- register int r = skagetlnsep(buffer_0f1, &satmp, "\n", 2) ;
+ int r = skagetlnsep(buffer_0f1, &satmp, "\n", 2) ;
if (r < 0)
{
if (errno != EPIPE || !stralloc_0(&satmp))
@@ -181,7 +181,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if ((buffer_puts(buffer_1, envs[i]) < 0)
|| (buffer_put(buffer_1, ": ", 2) < 2)) die() ;
pos += syslog_names(satmp.s + pos) ;
- if (buffer_put(buffer_1, satmp.s + pos, satmp.len - pos) < (int)(satmp.len - pos)) die() ;
+ if (buffer_put(buffer_1, satmp.s + pos, satmp.len - pos) < (ssize_t)(satmp.len - pos)) die() ;
}
}
return 0 ;