commit 4dc2b783b85f8d90eb45684efc55696e9b070ea8
parent af8e38f5fa0f5d29f619ac2cabae3fbc98ad6073
Author: sin <sin@2f30.org>
Date: Mon, 17 Nov 2014 16:27:12 +0000
Nuke some fprintf() calls and replace with weprintf()
Diffstat:
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/chgrp.c b/chgrp.c
@@ -25,7 +25,7 @@ static void
chgrp(const char *path)
{
if (chown(path, st.st_uid, gid) == -1) {
- fprintf(stderr, "chgrp: '%s': %s\n", path, strerror(errno));
+ weprintf("chown %s:", path);
failures++;
}
if (rflag)
@@ -58,8 +58,7 @@ main(int argc, char *argv[])
while (*++argv) {
if (stat(*argv, &st) == -1) {
- fprintf(stderr, "stat %s: %s\n", *argv,
- strerror(errno));
+ weprintf("stat %s:", *argv);
failures++;
continue;
}
diff --git a/renice.c b/renice.c
@@ -1,5 +1,4 @@
/* See LICENSE file for copyright and license details. */
-#include <errno.h>
#include <limits.h>
#include <pwd.h>
#include <stdio.h>
@@ -55,7 +54,6 @@ main(int argc, char *argv[])
errno = 0;
do pwd = getpwnam(argv[i]); while (errno == EINTR);
-
if (pwd)
who = pwd->pw_uid;
else if (errno != 0) {
@@ -83,11 +81,11 @@ strtop(const char *s)
errno = 0;
n = strtol(s, &end, 10);
if (*end != '\0') {
- fprintf(stderr, "%s: not an integer\n", s);
+ weprintf("%s: not an integer\n", s);
return -1;
}
if (errno != 0 || n <= 0 || n > INT_MAX) {
- fprintf(stderr, "%s: invalid value\n", s);
+ weprintf("%s: invalid value\n", s);
return -1;
}
@@ -100,15 +98,13 @@ renice(int which, int who, long adj)
errno = 0;
adj += getpriority(which, who);
if (errno != 0) {
- fprintf(stderr, "can't get %d nice level: %s\n",
- who, strerror(errno));
+ weprintf("getpriority %d:", who);
return 0;
}
adj = MAX(PRIO_MIN, MIN(adj, PRIO_MAX));
if (setpriority(which, who, (int)adj) == -1) {
- fprintf(stderr, "can't set %d nice level: %s\n",
- who, strerror(errno));
+ weprintf("setpriority %d:", who);
return 0;
}