aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32.c
diff options
context:
space:
mode:
authorEli Zaretskii2020-02-24 18:16:51 +0200
committerEli Zaretskii2020-02-24 18:16:51 +0200
commit7dfe90a666ab6b90597e3ee61c141da088da340c (patch)
treec89accc53840eaa8b92186a207616883eb8ce3ca /src/w32.c
parent9d626dffc6ba62c0d7a1a5c712f576ed8684fd66 (diff)
downloademacs-7dfe90a666ab6b90597e3ee61c141da088da340c.tar.gz
emacs-7dfe90a666ab6b90597e3ee61c141da088da340c.zip
Adapt the MS-Windows build to 'nofollow' changes
* nt/gnulib-cfg.mk (OMIT_GNULIB_MODULE_fchmodat) (OMIT_GNULIB_MODULE_lchmod): Set to true to omit building these modules on MS-Windows. * nt/mingw-cfg.site (ac_cv_func_fchmodat) (gl_cv_func_fchmodat_works, ac_cv_func_lchmod): Disable tests on MS-Windows. * src/w32.c (chmod_worker, lchmod, fchmodat): New functions. (sys_chmod): Move most of the code to chmod_worker. * src/w32.h (fchmodat, lchmod): Add prototypes.
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/w32.c b/src/w32.c
index a3b9a5683ad..cf1a3b37678 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -4320,10 +4320,9 @@ sys_chdir (const char * path)
4320 } 4320 }
4321} 4321}
4322 4322
4323int 4323static int
4324sys_chmod (const char * path, int mode) 4324chmod_worker (const char * path, int mode)
4325{ 4325{
4326 path = chase_symlinks (map_w32_filename (path, NULL));
4327 if (w32_unicode_filenames) 4326 if (w32_unicode_filenames)
4328 { 4327 {
4329 wchar_t path_w[MAX_PATH]; 4328 wchar_t path_w[MAX_PATH];
@@ -4341,6 +4340,20 @@ sys_chmod (const char * path, int mode)
4341} 4340}
4342 4341
4343int 4342int
4343sys_chmod (const char * path, int mode)
4344{
4345 path = chase_symlinks (map_w32_filename (path, NULL));
4346 return chmod_worker (path, mode);
4347}
4348
4349int
4350lchmod (const char * path, mode_t mode)
4351{
4352 path = map_w32_filename (path, NULL);
4353 return chmod_worker (path, mode);
4354}
4355
4356int
4344sys_creat (const char * path, int mode) 4357sys_creat (const char * path, int mode)
4345{ 4358{
4346 path = map_w32_filename (path, NULL); 4359 path = map_w32_filename (path, NULL);
@@ -4619,6 +4632,28 @@ fchmod (int fd, mode_t mode)
4619} 4632}
4620 4633
4621int 4634int
4635fchmodat (int fd, char const *path, mode_t mode, int flags)
4636{
4637 /* Rely on a hack: an open directory is modeled as file descriptor 0,
4638 as in fstatat. FIXME: Add proper support for fchmodat. */
4639 char fullname[MAX_UTF8_PATH];
4640
4641 if (fd != AT_FDCWD)
4642 {
4643 if (_snprintf (fullname, sizeof fullname, "%s/%s", dir_pathname, path)
4644 < 0)
4645 {
4646 errno = ENAMETOOLONG;
4647 return -1;
4648 }
4649 path = fullname;
4650 }
4651
4652 return
4653 flags == AT_SYMLINK_NOFOLLOW ? lchmod (path, mode) : sys_chmod (path, mode);
4654}
4655
4656int
4622sys_rename_replace (const char *oldname, const char *newname, BOOL force) 4657sys_rename_replace (const char *oldname, const char *newname, BOOL force)
4623{ 4658{
4624 BOOL result; 4659 BOOL result;