From: Karel Zak Date: Tue, 27 Mar 2012 12:05:56 +0000 (+0200) Subject: eject: remove unnecessary checks X-Git-Tag: v2.22-rc1~555^2~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ad5c08f017bb795c4c4587a8e1eadfb66e4838a1;p=thirdparty%2Futil-linux.git eject: remove unnecessary checks Signed-off-by: Karel Zak --- diff --git a/misc-utils/eject.c b/misc-utils/eject.c index c9b03816c3..7a847bf28f 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);