From 54d4b6e74bf539930db2cafbe075416894900076 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 12 Mar 2017 13:44:14 +0000 Subject: Fix a few omissions --- src/minutils/s6-hostname.c | 4 ++-- src/minutils/s6-logwatch.c | 5 ++--- src/minutils/s6-ps.c | 12 ++++++------ src/minutils/s6-swapoff.c | 4 ++-- src/minutils/s6-swapon.c | 8 ++++---- src/minutils/s6-umount.c | 4 ++-- src/minutils/s6ps_pfield.c | 4 ++-- 7 files changed, 20 insertions(+), 21 deletions(-) (limited to 'src/minutils') diff --git a/src/minutils/s6-hostname.c b/src/minutils/s6-hostname.c index deb525b..9d71cbe 100644 --- a/src/minutils/s6-hostname.c +++ b/src/minutils/s6-hostname.c @@ -5,7 +5,7 @@ #endif #include -#include +#include #include #include #include @@ -25,7 +25,7 @@ static int getit (void) static int setit (char const *h) { - if (sethostname(h, str_len(h)) < 0) + if (sethostname(h, strlen(h)) < 0) strerr_diefu1sys(111, "set hostname") ; return 0 ; } diff --git a/src/minutils/s6-logwatch.c b/src/minutils/s6-logwatch.c index d522b5e..42214d7 100644 --- a/src/minutils/s6-logwatch.c +++ b/src/minutils/s6-logwatch.c @@ -1,15 +1,14 @@ /* ISC license. */ -#include #include #include +#include #include #include #include #include #include #include -#include #include #include #include @@ -120,7 +119,7 @@ int main (int argc, char const *const *argv) while (i < (size_t)r) { struct inotify_event *ie = (struct inotify_event *)(iebuf + i) ; - if ((ie->wd != w) || !ie->len || str_diff(ie->name, "current")) goto cont ; + if ((ie->wd != w) || !ie->len || strcmp(ie->name, "current")) goto cont ; if (ie->mask & IN_MODIFY) { if (state) X() ; diff --git a/src/minutils/s6-ps.c b/src/minutils/s6-ps.c index 5b1a568..c3d85fc 100644 --- a/src/minutils/s6-ps.c +++ b/src/minutils/s6-ps.c @@ -352,11 +352,11 @@ int main (int argc, char const *const *argv) { unsigned int rightformatted = !!(((uint64_t)1 << fieldlist[i]) & RIGHTFORMATTED) ; size_t len = strlen(s6ps_fieldheaders[fieldlist[i]]) ; - if (rightformatted && (buffer_put(buffer_1, spaces, maxlen[i] - len) < (int)(maxlen[i] - len))) + if (rightformatted && (buffer_put(buffer_1, spaces, maxlen[i] - len) < (ssize_t)(maxlen[i] - len))) goto nowrite ; - if (buffer_put(buffer_1, s6ps_fieldheaders[fieldlist[i]], len) < (int)len) + if (buffer_put(buffer_1, s6ps_fieldheaders[fieldlist[i]], len) < (ssize_t)len) goto nowrite ; - if ((i < nfields-1) && (buffer_put(buffer_1, spaces, !rightformatted * (maxlen[i] - len) + spacing) < (int)(!rightformatted * (maxlen[i] - len) + spacing))) + if ((i < nfields-1) && (buffer_put(buffer_1, spaces, !rightformatted * (maxlen[i] - len) + spacing) < (ssize_t)(!rightformatted * (maxlen[i] - len) + spacing))) goto nowrite ; } if (buffer_put(buffer_1, "\n", 1) < 1) goto nowrite ; @@ -367,11 +367,11 @@ int main (int argc, char const *const *argv) for (; j < nfields ; j++) { unsigned int rightformatted = !!(((uint64_t)1 << fieldlist[j]) & RIGHTFORMATTED) ; - if (rightformatted && (buffer_put(buffer_1, spaces, maxlen[j] - fmtlen[oi][j]) < (int)(maxlen[j] - fmtlen[oi][j]))) + if (rightformatted && (buffer_put(buffer_1, spaces, maxlen[j] - fmtlen[oi][j]) < (ssize_t)(maxlen[j] - fmtlen[oi][j]))) goto nowrite ; - if (buffer_put(buffer_1, p[oi].data.s + fmtpos[oi][j], fmtlen[oi][j]) < (int)fmtlen[oi][j]) + if (buffer_put(buffer_1, p[oi].data.s + fmtpos[oi][j], fmtlen[oi][j]) < (ssize_t)fmtlen[oi][j]) goto nowrite ; - if ((j < nfields-1) && (buffer_put(buffer_1, spaces, !rightformatted * (maxlen[j] - fmtlen[oi][j]) + spacing) < (int)(!rightformatted * (maxlen[j] - fmtlen[oi][j]) + spacing))) + if ((j < nfields-1) && (buffer_put(buffer_1, spaces, !rightformatted * (maxlen[j] - fmtlen[oi][j]) + spacing) < (ssize_t)(!rightformatted * (maxlen[j] - fmtlen[oi][j]) + spacing))) goto nowrite ; } if (buffer_put(buffer_1, "\n", 1) < 1) goto nowrite ; diff --git a/src/minutils/s6-swapoff.c b/src/minutils/s6-swapoff.c index 80df1ec..b6ba40b 100644 --- a/src/minutils/s6-swapoff.c +++ b/src/minutils/s6-swapoff.c @@ -1,6 +1,8 @@ /* ISC license. */ +#include #include +#include #include #include #include @@ -9,8 +11,6 @@ #include #include -extern int swapoff (char const *) ; - #define USAGE "s6-swapoff device s6-swapoff -a" #define BUFSIZE 4095 diff --git a/src/minutils/s6-swapon.c b/src/minutils/s6-swapon.c index 6edd743..9a1b208 100644 --- a/src/minutils/s6-swapon.c +++ b/src/minutils/s6-swapon.c @@ -1,12 +1,12 @@ /* ISC license. */ +#include +#include +#include #include #include -#include #include -extern int swapon (const char *, unsigned int) ; - #define USAGE "s6-swapon device s6-swapon -a" static int swaponall () @@ -16,7 +16,7 @@ static int swaponall () FILE *yuck = setmntent("/etc/fstab", "r") ; if (!yuck) strerr_diefu1sys(111, "setmntent /etc/fstab") ; while ((d = getmntent(yuck))) - if (!str_diff(d->mnt_type, "swap") && (swapon(d->mnt_fsname, 0) == -1)) + if (!strcmp(d->mnt_type, "swap") && (swapon(d->mnt_fsname, 0) == -1)) { e++ ; strerr_warnwu2sys("swapon ", d->mnt_fsname) ; diff --git a/src/minutils/s6-umount.c b/src/minutils/s6-umount.c index 31773cb..eee2910 100644 --- a/src/minutils/s6-umount.c +++ b/src/minutils/s6-umount.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include +#include #include #include #include @@ -25,7 +25,7 @@ static int umountall ( ) int r ; int fd = open_readb("/proc/mounts") ; if (fd < 0) strerr_diefu1sys(111, "open /proc/mounts") ; - byte_zero(mountpoints, sizeof(mountpoints)) ; + memset(mountpoints, 0, sizeof(mountpoints)) ; buffer_init(&b, &buffer_read, fd, buf, BUFSIZE+1) ; for (;;) { diff --git a/src/minutils/s6ps_pfield.c b/src/minutils/s6ps_pfield.c index 3930d32..6072eb9 100644 --- a/src/minutils/s6ps_pfield.c +++ b/src/minutils/s6ps_pfield.c @@ -1,12 +1,12 @@ /* ISC license. */ +#include #include #include #include #include #include #include -#include #include #include #include @@ -443,7 +443,7 @@ static int fmt_args (pscan_t *p, size_t *pos, size_t *len) unsigned int i = 0 ; for (; i < 4 * (unsigned int)p->height - 3 ; i++) p->data.s[p->data.len + i] = ' ' ; - byte_copy(p->data.s + p->data.len + 4 * p->height - 3, 3, "\\_ ") ; + memcpy(p->data.s + p->data.len + 4 * p->height - 3, "\\_ ", 3) ; p->data.len += p->height << 2 ; } if (p->cmdlen) -- cgit v1.2.3