Module Name:    src
Committed By:   jakllsch
Date:           Fri May 18 13:51:17 UTC 2012

Modified Files:
        src/sbin/amrctl: amrctl.c

Log Message:
Use err(3) instead of perror(3) + exit(3).
Additionally, use symbolic EXIT_FAILURE.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sbin/amrctl/amrctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/amrctl/amrctl.c
diff -u src/sbin/amrctl/amrctl.c:1.5 src/sbin/amrctl/amrctl.c:1.6
--- src/sbin/amrctl/amrctl.c:1.5	Fri May 18 13:47:33 2012
+++ src/sbin/amrctl/amrctl.c	Fri May 18 13:51:17 2012
@@ -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 @@ amr_ioctl_enquiry(int fd, u_int8_t cmd, 
 		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 @@ main(int argc, char *argv[])
 		
 	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) {

Reply via email to