diff options
| author | Eli Zaretskii | 2020-02-24 18:16:51 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2020-02-24 18:16:51 +0200 |
| commit | 7dfe90a666ab6b90597e3ee61c141da088da340c (patch) | |
| tree | c89accc53840eaa8b92186a207616883eb8ce3ca | |
| parent | 9d626dffc6ba62c0d7a1a5c712f576ed8684fd66 (diff) | |
| download | emacs-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.
| -rw-r--r-- | nt/gnulib-cfg.mk | 2 | ||||
| -rw-r--r-- | nt/mingw-cfg.site | 3 | ||||
| -rw-r--r-- | src/w32.c | 41 | ||||
| -rw-r--r-- | src/w32.h | 2 |
4 files changed, 45 insertions, 3 deletions
diff --git a/nt/gnulib-cfg.mk b/nt/gnulib-cfg.mk index 08e83e028da..1d120a973d1 100644 --- a/nt/gnulib-cfg.mk +++ b/nt/gnulib-cfg.mk | |||
| @@ -63,3 +63,5 @@ OMIT_GNULIB_MODULE_sys_time = true | |||
| 63 | OMIT_GNULIB_MODULE_sys_types = true | 63 | OMIT_GNULIB_MODULE_sys_types = true |
| 64 | OMIT_GNULIB_MODULE_unistd = true | 64 | OMIT_GNULIB_MODULE_unistd = true |
| 65 | OMIT_GNULIB_MODULE_canonicalize-lgpl = true | 65 | OMIT_GNULIB_MODULE_canonicalize-lgpl = true |
| 66 | OMIT_GNULIB_MODULE_fchmodat = true | ||
| 67 | OMIT_GNULIB_MODULE_lchmod = true | ||
diff --git a/nt/mingw-cfg.site b/nt/mingw-cfg.site index dfdca3926f9..5bd5b834634 100644 --- a/nt/mingw-cfg.site +++ b/nt/mingw-cfg.site | |||
| @@ -102,6 +102,9 @@ ac_cv_func_lstat=yes | |||
| 102 | gl_cv_func_lstat_dereferences_slashed_symlink=yes | 102 | gl_cv_func_lstat_dereferences_slashed_symlink=yes |
| 103 | ac_cv_func_fstatat=yes | 103 | ac_cv_func_fstatat=yes |
| 104 | gl_cv_func_fstatat_zero_flag=yes | 104 | gl_cv_func_fstatat_zero_flag=yes |
| 105 | ac_cv_func_fchmodat=yes | ||
| 106 | gl_cv_func_fchmodat_works="not-needed-so-yes" | ||
| 107 | ac_cv_func_lchmod=yes | ||
| 105 | # Aliased to _commit in ms-w32.h | 108 | # Aliased to _commit in ms-w32.h |
| 106 | ac_cv_func_fsync=yes | 109 | ac_cv_func_fsync=yes |
| 107 | ac_cv_func_fdatasync=yes | 110 | ac_cv_func_fdatasync=yes |
| @@ -4320,10 +4320,9 @@ sys_chdir (const char * path) | |||
| 4320 | } | 4320 | } |
| 4321 | } | 4321 | } |
| 4322 | 4322 | ||
| 4323 | int | 4323 | static int |
| 4324 | sys_chmod (const char * path, int mode) | 4324 | chmod_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 | ||
| 4343 | int | 4342 | int |
| 4343 | sys_chmod (const char * path, int mode) | ||
| 4344 | { | ||
| 4345 | path = chase_symlinks (map_w32_filename (path, NULL)); | ||
| 4346 | return chmod_worker (path, mode); | ||
| 4347 | } | ||
| 4348 | |||
| 4349 | int | ||
| 4350 | lchmod (const char * path, mode_t mode) | ||
| 4351 | { | ||
| 4352 | path = map_w32_filename (path, NULL); | ||
| 4353 | return chmod_worker (path, mode); | ||
| 4354 | } | ||
| 4355 | |||
| 4356 | int | ||
| 4344 | sys_creat (const char * path, int mode) | 4357 | sys_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 | ||
| 4621 | int | 4634 | int |
| 4635 | fchmodat (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 | |||
| 4656 | int | ||
| 4622 | sys_rename_replace (const char *oldname, const char *newname, BOOL force) | 4657 | sys_rename_replace (const char *oldname, const char *newname, BOOL force) |
| 4623 | { | 4658 | { |
| 4624 | BOOL result; | 4659 | BOOL result; |
| @@ -222,6 +222,8 @@ extern void register_child (pid_t, int); | |||
| 222 | extern void sys_sleep (int); | 222 | extern void sys_sleep (int); |
| 223 | extern int sys_link (const char *, const char *); | 223 | extern int sys_link (const char *, const char *); |
| 224 | extern int openat (int, const char *, int, int); | 224 | extern int openat (int, const char *, int, int); |
| 225 | extern int fchmodat (int, char const *, mode_t, int); | ||
| 226 | extern int lchmod (char const *, mode_t); | ||
| 225 | 227 | ||
| 226 | /* Return total and free memory info. */ | 228 | /* Return total and free memory info. */ |
| 227 | extern int w32_memory_info (unsigned long long *, unsigned long long *, | 229 | extern int w32_memory_info (unsigned long long *, unsigned long long *, |