Message-ID: <395643BB.7109B0DA@softhome.net> Date: Sun, 25 Jun 2000 19:39:07 +0200 From: Laurynas Biveinis X-Mailer: Mozilla 4.73 [en] (Win98; U) X-Accept-Language: lt,en MIME-Version: 1.0 To: DJGPP Workers Subject: Patch: chown() preparation for symlinks Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com This patch changes !__file_exists(...) to access(..., F_OK). access() will be converted to accept symlinks, and __file_exists() won't be. chown() works with this change with and without symlinks. Also it fixes warning about unused variables and removes redudant includes. OK to commit? Laurynas Index: chown.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/chown.c,v retrieving revision 1.1 diff -u -r1.1 chown.c --- chown.c 1995/06/18 07:43:52 1.1 +++ chown.c 2000/06/25 17:32:39 @@ -1,7 +1,6 @@ +/* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include #include -#include #include /* MS-DOS couldn't care less about file ownerships, so we could @@ -9,9 +8,10 @@ and for devices. */ int -chown(const char *path, uid_t owner, gid_t group) +chown(const char *path, uid_t owner __attribute__((__unused__)), + gid_t group __attribute__((__unused__))) { - if (!__file_exists(path)) /* non-existent file */ + if (access(path, F_OK)) /* non-existent file */ { errno = ENOENT; return -1;