Mail Archives: djgpp-workers/2000/06/25/13:35:21
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 <libc/stubs.h>
#include <unistd.h>
-#include <sys/stat.h>
#include <errno.h>
/* 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;
- Raw text -