Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/amrctl Use err(3) instead of perror(3) + exit(3).
details: https://anonhg.NetBSD.org/src/rev/d2f2699a1fe2
branches: trunk
changeset: 779316:d2f2699a1fe2
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Fri May 18 13:51:17 2012 +0000
description:
Use err(3) instead of perror(3) + exit(3).
Additionally, use symbolic EXIT_FAILURE.
diffstat:
sbin/amrctl/amrctl.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diffs (36 lines):
diff -r dc4c31dcc6bd -r d2f2699a1fe2 sbin/amrctl/amrctl.c
--- a/sbin/amrctl/amrctl.c Fri May 18 13:47:33 2012 +0000
+++ b/sbin/amrctl/amrctl.c Fri May 18 13:51:17 2012 +0000
@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
+#include <err.h>
#include <errno.h>
#include <unistd.h>
@@ -172,8 +173,7 @@
r = ioctl(fd, AMR_IO_COMMAND, &am);
if (r == -1) {
if (errno != EBUSY) {
- perror("ioctl enquiry");
- exit(1);
+ err(EXIT_FAILURE, "ioctl enquiry");
} else
usleep(sleeptime);
}
@@ -643,12 +643,10 @@
fd = open(filename, O_RDONLY);
if (fd == -1) {
- perror("open");
- exit(1);
+ err(EXIT_FAILURE, "open");
}
if (ioctl(fd, AMR_IO_VERSION, &i) == -1) {
- perror("ioctl version");
- exit(1);
+ err(EXIT_FAILURE, "ioctl version");
}
if (sflags) {
Home |
Main Index |
Thread Index |
Old Index