aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-03 19:57:50 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-03 19:57:50 +0000
commitb6332248ca4d781b4142fb9b6fe7e97a4a9ad59d (patch)
treed38d7aeeae4940732ce09c34bb7057fad4bc8f04
parent9275814a9e6a3af390c932238c0b1130de8d0edd (diff)
downloadbusybox-w32-b6332248ca4d781b4142fb9b6fe7e97a4a9ad59d.tar.gz
busybox-w32-b6332248ca4d781b4142fb9b6fe7e97a4a9ad59d.tar.bz2
busybox-w32-b6332248ca4d781b4142fb9b6fe7e97a4a9ad59d.zip
fdformat: remove redundant check
-rw-r--r--libbb/xfuncs.c2
-rw-r--r--util-linux/fdformat.c13
2 files changed, 7 insertions, 8 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 7b95e49f1..4aa1c3000 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -498,7 +498,7 @@ void xlisten(int s, int backlog)
498void xstat(char *name, struct stat *stat_buf) 498void xstat(char *name, struct stat *stat_buf)
499{ 499{
500 if (stat(name, stat_buf)) 500 if (stat(name, stat_buf))
501 bb_perror_msg_and_die("Can't stat '%s'", name); 501 bb_perror_msg_and_die("can't stat '%s'", name);
502} 502}
503#endif 503#endif
504 504
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index 1441b9228..9b97e6873 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -66,10 +66,7 @@ int fdformat_main(int argc,char **argv)
66 verify = !bb_getopt_ulflags(argc, argv, "n"); 66 verify = !bb_getopt_ulflags(argc, argv, "n");
67 argv += optind; 67 argv += optind;
68 68
69 /* R_OK is needed for verifying */ 69 xstat(*argv, &st);
70 if (stat(*argv, &st) < 0 || access(*argv, W_OK | R_OK ) < 0) {
71 bb_perror_msg_and_die("%s", *argv);
72 }
73 if (!S_ISBLK(st.st_mode)) { 70 if (!S_ISBLK(st.st_mode)) {
74 bb_error_msg_and_die("%s: not a block device", *argv); 71 bb_error_msg_and_die("%s: not a block device", *argv);
75 /* do not test major - perhaps this was an USB floppy */ 72 /* do not test major - perhaps this was an USB floppy */
@@ -78,9 +75,10 @@ int fdformat_main(int argc,char **argv)
78 /* O_RDWR for formatting and verifying */ 75 /* O_RDWR for formatting and verifying */
79 fd = xopen(*argv, O_RDWR); 76 fd = xopen(*argv, O_RDWR);
80 77
81 xioctl(fd, FDGETPRM, &param, "FDGETPRM");/*original message was: "Could not determine current format type" */ 78 /* original message was: "Could not determine current format type" */
79 xioctl(fd, FDGETPRM, &param, "FDGETPRM");
82 80
83 printf("%s-sided, %d tracks, %d sec/track. Total capacity %d kB.\n", 81 printf("%s-sided, %d tracks, %d sec/track. Total capacity %d kB\n",
84 (param.head == 2) ? "Double" : "Single", 82 (param.head == 2) ? "Double" : "Single",
85 param.track, param.sect, param.size >> 1); 83 param.track, param.sect, param.size >> 1);
86 84
@@ -117,7 +115,8 @@ int fdformat_main(int argc,char **argv)
117 if (read_bytes < 0) { 115 if (read_bytes < 0) {
118 bb_perror_msg(bb_msg_read_error); 116 bb_perror_msg(bb_msg_read_error);
119 } 117 }
120 bb_error_msg_and_die("problem reading cylinder %d, expected %d, read %d", cyl, n, read_bytes); 118 bb_error_msg_and_die("problem reading cylinder %d, "
119 "expected %d, read %d", cyl, n, read_bytes);
121 // FIXME: maybe better seek & continue?? 120 // FIXME: maybe better seek & continue??
122 } 121 }
123 /* Check backwards so we don't need a counter */ 122 /* Check backwards so we don't need a counter */