From: Karel Zak Date: Tue, 27 Mar 2012 12:08:02 +0000 (+0200) Subject: eject: remove unnecessary function X-Git-Tag: v2.22-rc1~555^2~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f0ade3870c8d131ee1a1950d16020f08112c03a4;p=thirdparty%2Futil-linux.git eject: remove unnecessary function Signed-off-by: Karel Zak --- diff --git a/misc-utils/eject.c b/misc-utils/eject.c index 7a847bf28f..cc877b63a1 100644 --- a/misc-utils/eject.c +++ b/misc-utils/eject.c @@ -229,20 +229,6 @@ static void parse_args(int argc, char **argv, char **device) *device = xstrdup(argv[optind]); } -/* Return 1 if file/device exists, 0 otherwise. */ -static int file_exists(const char *name) { - /* - * access() uses the UID, not the EUID. This way a normal user - * cannot find out if a file (say, /root/fubar) exists or not, even - * if eject is SUID root - */ - if (access (name, F_OK) == 0) { - return 1; - } else { - return 0; - } -} - /* * Given name, such as foo, see if any of the following exist: * @@ -259,13 +245,13 @@ static char *find_device(const char *name) { if ((name[0] == '.') || (name[0] == '/')) { strcpy(buf, name); - if (file_exists(buf)) + if (access(buf, F_OK) == 0) return buf; } strcpy(buf, "/dev/"); strcat(buf, name); - if (file_exists(buf)) + if (access (name, F_OK) == 0) return buf; free(buf);