aboutsummaryrefslogtreecommitdiff
path: root/fdflush.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-12-22 01:48:07 +0000
committerMatt Kraai <kraai@debian.org>2000-12-22 01:48:07 +0000
commita9819b290848e0a760f3805d5937fa050235d707 (patch)
treeb8cb8d939032c0806d62161b01e5836cb808dc3f /fdflush.c
parente9f07fb6e83b75a50760599a5d31f494841eddf7 (diff)
downloadbusybox-a9819b290848e0a760f3805d5937fa050235d707.tar.gz
Use busybox error handling functions wherever possible.
Diffstat (limited to 'fdflush.c')
-rw-r--r--fdflush.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/fdflush.c b/fdflush.c
index 380015dde..5eb93ddd7 100644
--- a/fdflush.c
+++ b/fdflush.c
@@ -31,26 +31,16 @@
extern int fdflush_main(int argc, char **argv)
{
- int value;
int fd;
if (argc <= 1 || **(++argv) == '-')
usage(fdflush_usage);
- fd = open(*argv, 0);
- if (fd < 0) {
- perror(*argv);
- return EXIT_FAILURE;
- }
+ 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);
- return EXIT_FAILURE;
- }
return EXIT_SUCCESS;
}