mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-21 06:55:39 +00:00
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.
This commit is contained in:
parent
9d626dffc6
commit
7dfe90a666
@ -63,3 +63,5 @@ OMIT_GNULIB_MODULE_sys_time = true
|
||||
OMIT_GNULIB_MODULE_sys_types = true
|
||||
OMIT_GNULIB_MODULE_unistd = true
|
||||
OMIT_GNULIB_MODULE_canonicalize-lgpl = true
|
||||
OMIT_GNULIB_MODULE_fchmodat = true
|
||||
OMIT_GNULIB_MODULE_lchmod = true
|
||||
|
@ -102,6 +102,9 @@ ac_cv_func_lstat=yes
|
||||
gl_cv_func_lstat_dereferences_slashed_symlink=yes
|
||||
ac_cv_func_fstatat=yes
|
||||
gl_cv_func_fstatat_zero_flag=yes
|
||||
ac_cv_func_fchmodat=yes
|
||||
gl_cv_func_fchmodat_works="not-needed-so-yes"
|
||||
ac_cv_func_lchmod=yes
|
||||
# Aliased to _commit in ms-w32.h
|
||||
ac_cv_func_fsync=yes
|
||||
ac_cv_func_fdatasync=yes
|
||||
|
41
src/w32.c
41
src/w32.c
@ -4320,10 +4320,9 @@ sys_chdir (const char * path)
|
||||
}
|
||||
}
|
||||
|
||||
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];
|
||||
@ -4340,6 +4339,20 @@ sys_chmod (const char * path, int mode)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -4618,6 +4631,28 @@ fchmod (int fd, mode_t 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)
|
||||
{
|
||||
|
@ -222,6 +222,8 @@ extern void register_child (pid_t, int);
|
||||
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 *,
|
||||
|
Loading…
Reference in New Issue
Block a user