projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
A small cleanup by Vladimir
[oweals/busybox.git]
/
util-linux
/
fdflush.c
diff --git
a/util-linux/fdflush.c
b/util-linux/fdflush.c
index 4ec0a8886b9a6dfe35ff9a31c64e82afb488a677..f10cceae08054830b8659780ff2fab62b143cd66 100644
(file)
--- a/
util-linux/fdflush.c
+++ b/
util-linux/fdflush.c
@@
-21,40
+21,27
@@
*
*/
*
*/
-#include "
internal
.h"
+#include "
busybox
.h"
#include <stdio.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <sys/ioctl.h>
-#include <linux/fd.h>
#include <fcntl.h>
#include <fcntl.h>
+#include <stdlib.h>
+/* From <linux/fd.h> */
+#define FDFLUSH _IO(2,0x4b)
extern int fdflush_main(int argc, char **argv)
{
extern int fdflush_main(int argc, char **argv)
{
- int value;
int fd;
int fd;
- if (argc <= 1 || **(++argv) == '-') {
- usage("fdflush DEVICE\n"
-#ifndef BB_FEATURE_TRIVIAL_HELP
- "\nForces floppy disk drive to detect disk change\n"
-#endif
- );
- }
+ if (argc <= 1 || **(++argv) == '-')
+ show_usage();
- fd = open(*argv, 0);
- if (fd < 0) {
- perror(*argv);
- exit(FALSE);
- }
+ if ((fd = open(*argv, 0)) < 0)
+ perror_msg_and_die("%s", *argv);
- value = ioctl(fd, FDFLUSH, 0);
- /* Don't bother closing. Exit does
- * that, so we can save a few bytes */
- /* close(fd); */
+ if (ioctl(fd, FDFLUSH, 0))
+ perror_msg_and_die("%s", *argv);
- if (value) {
- perror(*argv);
- exit(FALSE);
- }
- exit(TRUE);
+ return EXIT_SUCCESS;
}
}