Mail Archives: djgpp-workers/2000/08/22/08:08:21
Is there anything else I could say?
Comments?
Laurynas
Index: djgpp/src/libc/posix/sys/stat/chmod.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/chmod.c,v
retrieving revision 1.1
diff -u -p -r1.1 chmod.c
--- chmod.c 1995/08/28 03:42:36 1.1
+++ chmod.c 2000/08/22 10:02:43
@@ -1,14 +1,23 @@
+/* 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 <libc/symlink.h>
#include <sys/stat.h>
#include <io.h>
+#include <stdio.h>
int
chmod(const char *filename, int pmode)
{
int dmode;
- unsigned attr = _chmod(filename, 0, 0);
-
+ char real_name[FILENAME_MAX];
+ int attr;
+
+ if (!__solve_symlinks(filename, real_name))
+ return -1;
+
+ attr = _chmod(real_name, 0, 0);
+
if (attr == -1)
return -1;
@@ -19,7 +28,7 @@ chmod(const char *filename, int pmode)
/* Must clear the directory and volume bits, otherwise 214301 fails.
Unused bits left alone (some network redirectors use them). */
- if (_chmod(filename, 1, (attr & 0xffe6) | dmode) == -1)
+ if (_chmod(real_name, 1, (attr & 0xffe6) | dmode) == -1)
return -1;
return 0;
}
- Raw text -