Nuke some fprintf() calls and replace with weprintf()
This commit is contained in:
parent
af8e38f5fa
commit
4dc2b783b8
5
chgrp.c
5
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;
|
||||
}
|
||||
|
|
12
renice.c
12
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user