summaryrefslogtreecommitdiffstats
path: root/misc-utils/eject.c
diff options
context:
space:
mode:
authorKarel Zak2012-03-27 14:05:56 +0200
committerKarel Zak2012-03-27 14:05:56 +0200
commitad5c08f017bb795c4c4587a8e1eadfb66e4838a1 (patch)
tree32d6c0b7ea1c8bd2bf5540f18e69716b3fafe726 /misc-utils/eject.c
parenteject: clean up argv parsing code (diff)
downloadkernel-qcow2-util-linux-ad5c08f017bb795c4c4587a8e1eadfb66e4838a1.tar.gz
kernel-qcow2-util-linux-ad5c08f017bb795c4c4587a8e1eadfb66e4838a1.tar.xz
kernel-qcow2-util-linux-ad5c08f017bb795c4c4587a8e1eadfb66e4838a1.zip
eject: remove unnecessary checks
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/eject.c')
-rw-r--r--misc-utils/eject.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/misc-utils/eject.c b/misc-utils/eject.c
index c9b03816c..7a847bf28 100644
--- a/misc-utils/eject.c
+++ b/misc-utils/eject.c
@@ -229,18 +229,6 @@ static void parse_args(int argc, char **argv, char **device)
*device = xstrdup(argv[optind]);
}
-void e_close(int fp) {
- if (close(fp)==-1) {
- err(1, NULL);
- }
-}
-
-void e_fclose(FILE *fp) {
- if (fclose(fp)==-1) {
- err(1, NULL);
- }
-}
-
/* Return 1 if file/device exists, 0 otherwise. */
static int file_exists(const char *name) {
/*
@@ -576,7 +564,7 @@ static int mounted_device(const char *name, char **mountName, char **deviceName)
get_major_minor(s1, &mtabmaj, &mtabmin);
if (((strcmp(s1, name) == 0) || (strcmp(s2, name) == 0)) ||
((maj != -1) && (maj == mtabmaj) && (min == mtabmin))) {
- e_fclose(fp);
+ fclose(fp);
*deviceName = strdup(s1);
*mountName = strdup(s2);
return 1;
@@ -585,7 +573,7 @@ static int mounted_device(const char *name, char **mountName, char **deviceName)
}
*deviceName = 0;
*mountName = 0;
- e_fclose(fp);
+ fclose(fp);
return 0;
}
@@ -624,7 +612,7 @@ static void unmount_devices(const char *pattern) {
}
}
}
- e_fclose(fp);
+ fclose(fp);
}
/*
@@ -895,7 +883,7 @@ int main(int argc, char **argv) {
}
/* cleanup */
- e_close(fd);
+ close(fd);
free(device);
free(deviceName);
free(fullName);