svn commit: trunk/busybox: libbb util-linux

vda at busybox.net vda at busybox.net
Tue Oct 3 19:57:51 UTC 2006


Author: vda
Date: 2006-10-03 12:57:50 -0700 (Tue, 03 Oct 2006)
New Revision: 16303

Log:
fdformat: remove redundant check


Modified:
   trunk/busybox/libbb/xfuncs.c
   trunk/busybox/util-linux/fdformat.c


Changeset:
Modified: trunk/busybox/libbb/xfuncs.c
===================================================================
--- trunk/busybox/libbb/xfuncs.c	2006-10-03 19:56:34 UTC (rev 16302)
+++ trunk/busybox/libbb/xfuncs.c	2006-10-03 19:57:50 UTC (rev 16303)
@@ -498,7 +498,7 @@
 void xstat(char *name, struct stat *stat_buf)
 {
 	if (stat(name, stat_buf))
-		bb_perror_msg_and_die("Can't stat '%s'", name);
+		bb_perror_msg_and_die("can't stat '%s'", name);
 }
 #endif
 

Modified: trunk/busybox/util-linux/fdformat.c
===================================================================
--- trunk/busybox/util-linux/fdformat.c	2006-10-03 19:56:34 UTC (rev 16302)
+++ trunk/busybox/util-linux/fdformat.c	2006-10-03 19:57:50 UTC (rev 16303)
@@ -66,10 +66,7 @@
 	verify = !bb_getopt_ulflags(argc, argv, "n");
 	argv += optind;
 
-	/* R_OK is needed for verifying */
-	if (stat(*argv, &st) < 0 || access(*argv, W_OK | R_OK ) < 0) {
-		bb_perror_msg_and_die("%s", *argv);
-	}
+	xstat(*argv, &st);
 	if (!S_ISBLK(st.st_mode)) {
 		bb_error_msg_and_die("%s: not a block device", *argv);
 		/* do not test major - perhaps this was an USB floppy */
@@ -78,9 +75,10 @@
 	/* O_RDWR for formatting and verifying */
 	fd = xopen(*argv, O_RDWR);
 
-	xioctl(fd, FDGETPRM, &param, "FDGETPRM");/*original message was: "Could not determine current format type" */
+	/* original message was: "Could not determine current format type" */
+	xioctl(fd, FDGETPRM, &param, "FDGETPRM");
 
-	printf("%s-sided, %d tracks, %d sec/track. Total capacity %d kB.\n",
+	printf("%s-sided, %d tracks, %d sec/track. Total capacity %d kB\n",
 		(param.head == 2) ? "Double" : "Single",
 		param.track, param.sect, param.size >> 1);
 
@@ -117,7 +115,8 @@
 				if (read_bytes < 0) {
 					bb_perror_msg(bb_msg_read_error);
 				}
-				bb_error_msg_and_die("problem reading cylinder %d, expected %d, read %d", cyl, n, read_bytes);
+				bb_error_msg_and_die("problem reading cylinder %d, "
+					"expected %d, read %d", cyl, n, read_bytes);
 				// FIXME: maybe better seek & continue??
 			}
 			/* Check backwards so we don't need a counter */




More information about the busybox-cvs mailing list