}
}
-int
-sys_chmod (const char * path, int mode)
+static int
+chmod_worker (const char * path, int mode)
{
- path = chase_symlinks (map_w32_filename (path, NULL));
if (w32_unicode_filenames)
{
wchar_t path_w[MAX_PATH];
}
}
+int
+sys_chmod (const char * path, int mode)
+{
+ path = chase_symlinks (map_w32_filename (path, NULL));
+ return chmod_worker (path, mode);
+}
+
+int
+lchmod (const char * path, mode_t mode)
+{
+ path = map_w32_filename (path, NULL);
+ return chmod_worker (path, mode);
+}
+
int
sys_creat (const char * path, int mode)
{
return 0;
}
+int
+fchmodat (int fd, char const *path, mode_t mode, int flags)
+{
+ /* Rely on a hack: an open directory is modeled as file descriptor 0,
+ as in fstatat. FIXME: Add proper support for fchmodat. */
+ char fullname[MAX_UTF8_PATH];
+
+ if (fd != AT_FDCWD)
+ {
+ if (_snprintf (fullname, sizeof fullname, "%s/%s", dir_pathname, path)
+ < 0)
+ {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
+ path = fullname;
+ }
+
+ return
+ flags == AT_SYMLINK_NOFOLLOW ? lchmod (path, mode) : sys_chmod (path, mode);
+}
+
int
sys_rename_replace (const char *oldname, const char *newname, BOOL force)
{
extern void sys_sleep (int);
extern int sys_link (const char *, const char *);
extern int openat (int, const char *, int, int);
+extern int fchmodat (int, char const *, mode_t, int);
+extern int lchmod (char const *, mode_t);
/* Return total and free memory info. */
extern int w32_memory_info (unsigned long long *, unsigned long long *,