diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-12 13:44:14 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-12 13:44:14 +0000 |
commit | 54d4b6e74bf539930db2cafbe075416894900076 (patch) | |
tree | 29df64c4ff1eddc3c692b82556e3dde5dc2ae0ee | |
parent | 495d625add9e52b29a98c4fa2627a45d20d44849 (diff) | |
download | s6-linux-utils-2.3.0.0.tar.xz |
Fix a few omissions2.3.0.0
-rw-r--r-- | src/minutils/s6-hostname.c | 4 | ||||
-rw-r--r-- | src/minutils/s6-logwatch.c | 5 | ||||
-rw-r--r-- | src/minutils/s6-ps.c | 12 | ||||
-rw-r--r-- | src/minutils/s6-swapoff.c | 4 | ||||
-rw-r--r-- | src/minutils/s6-swapon.c | 8 | ||||
-rw-r--r-- | src/minutils/s6-umount.c | 4 | ||||
-rw-r--r-- | src/minutils/s6ps_pfield.c | 4 |
7 files changed, 20 insertions, 21 deletions
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 <unistd.h> -#include <skalibs/bytestr.h> +#include <string.h> #include <skalibs/allreadwrite.h> #include <skalibs/strerr2.h> #include <skalibs/stralloc.h> @@ -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 <sys/types.h> #include <sys/uio.h> #include <errno.h> +#include <string.h> #include <unistd.h> #include <signal.h> #include <sys/ioctl.h> #include <sys/inotify.h> #include <skalibs/allreadwrite.h> #include <skalibs/sgetopt.h> -#include <skalibs/bytestr.h> #include <skalibs/strerr2.h> #include <skalibs/error.h> #include <skalibs/buffer.h> @@ -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 <unistd.h> #include <sys/types.h> +#include <sys/swap.h> #include <errno.h> #include <skalibs/bytestr.h> #include <skalibs/buffer.h> @@ -9,8 +11,6 @@ #include <skalibs/djbunix.h> #include <skalibs/skamisc.h> -extern int swapoff (char const *) ; - #define USAGE "s6-swapoff device <or> 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 <unistd.h> +#include <sys/swap.h> +#include <string.h> #include <stdio.h> #include <mntent.h> -#include <skalibs/bytestr.h> #include <skalibs/strerr2.h> -extern int swapon (const char *, unsigned int) ; - #define USAGE "s6-swapon device <or> 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 <sys/types.h> +#include <string.h> #include <sys/mount.h> #include <skalibs/bytestr.h> #include <skalibs/buffer.h> @@ -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 <string.h> #include <stdint.h> #include <unistd.h> #include <time.h> #include <sys/sysinfo.h> #include <skalibs/uint64.h> #include <skalibs/types.h> -#include <skalibs/bytestr.h> #include <skalibs/strerr2.h> #include <skalibs/tai.h> #include <skalibs/djbtime.h> @@ -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) |