Replace fprintf(stderr, ...) calls with weprintf()
This commit is contained in:
parent
135f6012cb
commit
8d187be64a
2
getty.c
2
getty.c
@ -61,7 +61,7 @@ main(int argc, char *argv[])
|
|||||||
if (ioctl(fd, TIOCSCTTY, (void *)1) == 0)
|
if (ioctl(fd, TIOCSCTTY, (void *)1) == 0)
|
||||||
vhangup();
|
vhangup();
|
||||||
else
|
else
|
||||||
fprintf(stderr, "could not set controlling tty\n");
|
weprintf("TIOCSCTTY: could not set controlling tty\n");
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
fd = open(tty, O_RDWR);
|
fd = open(tty, O_RDWR);
|
||||||
|
5
stat.c
5
stat.c
@ -2,11 +2,9 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@ -50,8 +48,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
if (fn(argv[i], &st) == -1) {
|
if (fn(argv[i], &st) == -1) {
|
||||||
fprintf(stderr, "%s %s: %s\n", fnname,
|
weprintf("%s %s:", fnname, argv[i]);
|
||||||
argv[i], strerror(errno));
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
#include <sys/swap.h>
|
#include <sys/swap.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <mntent.h>
|
#include <mntent.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -43,8 +42,7 @@ main(int argc, char *argv[])
|
|||||||
while ((me = getmntent(fp)) != NULL) {
|
while ((me = getmntent(fp)) != NULL) {
|
||||||
if (strcmp(me->mnt_type, MNTTYPE_SWAP) == 0) {
|
if (strcmp(me->mnt_type, MNTTYPE_SWAP) == 0) {
|
||||||
if (swapoff(me->mnt_fsname) < 0) {
|
if (swapoff(me->mnt_fsname) < 0) {
|
||||||
fprintf(stderr, "swapoff %s: %s\n",
|
weprintf("swapoff %s:", me->mnt_fsname);
|
||||||
me->mnt_fsname, strerror(errno));
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,8 +51,7 @@ main(int argc, char *argv[])
|
|||||||
} else {
|
} else {
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
if (swapoff(argv[i]) < 0) {
|
if (swapoff(argv[i]) < 0) {
|
||||||
fprintf(stderr, "swapoff %s: %s\n",
|
weprintf("swapoff %s:", argv[i]);
|
||||||
argv[i], strerror(errno));
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
swapon.c
7
swapon.c
@ -1,7 +1,6 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
#include <sys/swap.h>
|
#include <sys/swap.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <mntent.h>
|
#include <mntent.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -51,8 +50,7 @@ main(int argc, char *argv[])
|
|||||||
if (strcmp(me->mnt_type, MNTTYPE_SWAP) == 0
|
if (strcmp(me->mnt_type, MNTTYPE_SWAP) == 0
|
||||||
&& (hasmntopt(me, MNTOPT_NOAUTO) == NULL)) {
|
&& (hasmntopt(me, MNTOPT_NOAUTO) == NULL)) {
|
||||||
if (swapon(me->mnt_fsname, flags) < 0) {
|
if (swapon(me->mnt_fsname, flags) < 0) {
|
||||||
fprintf(stderr, "swapon %s: %s\n",
|
weprintf("swapon %s:", me->mnt_fsname);
|
||||||
me->mnt_fsname, strerror(errno));
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,8 +59,7 @@ main(int argc, char *argv[])
|
|||||||
} else {
|
} else {
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
if (swapon(argv[i], flags) < 0) {
|
if (swapon(argv[i], flags) < 0) {
|
||||||
fprintf(stderr, "swapon %s: %s\n",
|
weprintf("swapon %s:", argv[i]);
|
||||||
argv[i], strerror(errno));
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -41,14 +39,12 @@ main(int argc, char *argv[])
|
|||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
fd = open(argv[i], O_WRONLY | (cflag ? 0 : O_CREAT), 0644);
|
fd = open(argv[i], O_WRONLY | (cflag ? 0 : O_CREAT), 0644);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf(stderr, "open: cannot open `%s' for writing: %s\n",
|
weprintf("open: cannot open `%s' for writing:", argv[i]);
|
||||||
argv[i], strerror(errno));
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ftruncate(fd, size) < 0) {
|
if (ftruncate(fd, size) < 0) {
|
||||||
fprintf(stderr, "truncate: cannot open `%s' for writing: %s\n",
|
weprintf("ftruncate: cannot open `%s' for writing:", argv[i]);
|
||||||
argv[i], strerror(errno));
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user