From f0ade3870c8d131ee1a1950d16020f08112c03a4 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 27 Mar 2012 14:08:02 +0200 Subject: [PATCH] eject: remove unnecessary function Signed-off-by: Karel Zak --- misc-utils/eject.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) 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); -- 2.47.2