mirror of
https://github.com/sheumann/hush.git
synced 2025-01-03 00:31:16 +00:00
fdformat: remove redundant check
This commit is contained in:
parent
9275814a9e
commit
b6332248ca
@ -498,7 +498,7 @@ void xlisten(int s, int backlog)
|
|||||||
void xstat(char *name, struct stat *stat_buf)
|
void xstat(char *name, struct stat *stat_buf)
|
||||||
{
|
{
|
||||||
if (stat(name, 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
|
#endif
|
||||||
|
|
||||||
|
@ -66,10 +66,7 @@ int fdformat_main(int argc,char **argv)
|
|||||||
verify = !bb_getopt_ulflags(argc, argv, "n");
|
verify = !bb_getopt_ulflags(argc, argv, "n");
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
/* R_OK is needed for verifying */
|
xstat(*argv, &st);
|
||||||
if (stat(*argv, &st) < 0 || access(*argv, W_OK | R_OK ) < 0) {
|
|
||||||
bb_perror_msg_and_die("%s", *argv);
|
|
||||||
}
|
|
||||||
if (!S_ISBLK(st.st_mode)) {
|
if (!S_ISBLK(st.st_mode)) {
|
||||||
bb_error_msg_and_die("%s: not a block device", *argv);
|
bb_error_msg_and_die("%s: not a block device", *argv);
|
||||||
/* do not test major - perhaps this was an USB floppy */
|
/* do not test major - perhaps this was an USB floppy */
|
||||||
@ -78,9 +75,10 @@ int fdformat_main(int argc,char **argv)
|
|||||||
/* O_RDWR for formatting and verifying */
|
/* O_RDWR for formatting and verifying */
|
||||||
fd = xopen(*argv, O_RDWR);
|
fd = xopen(*argv, O_RDWR);
|
||||||
|
|
||||||
xioctl(fd, FDGETPRM, ¶m, "FDGETPRM");/*original message was: "Could not determine current format type" */
|
/* original message was: "Could not determine current format type" */
|
||||||
|
xioctl(fd, FDGETPRM, ¶m, "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.head == 2) ? "Double" : "Single",
|
||||||
param.track, param.sect, param.size >> 1);
|
param.track, param.sect, param.size >> 1);
|
||||||
|
|
||||||
@ -117,7 +115,8 @@ int fdformat_main(int argc,char **argv)
|
|||||||
if (read_bytes < 0) {
|
if (read_bytes < 0) {
|
||||||
bb_perror_msg(bb_msg_read_error);
|
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??
|
// FIXME: maybe better seek & continue??
|
||||||
}
|
}
|
||||||
/* Check backwards so we don't need a counter */
|
/* Check backwards so we don't need a counter */
|
||||||
|
Loading…
Reference in New Issue
Block a user