From 6dad71783c018d3ccabcede7db6ea206de5b3255 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 3 Aug 2012 13:23:30 +0300 Subject: Support symlinks on latest versions of MS-Windows. src/w32.c: Include winioctl.h and aclapi.h. (is_symlink, chase_symlinks, enable_privilege, restore_privilege) (revert_to_self): Forward declarations of static functions. : : New static flags. (globals_of_w32): Initialize them to zero. (GetSecurityInfo_Proc, CreateSymbolicLink_Proc): New typedefs. (map_w32_filename): Improve commentary. Simplify switch. (SYMBOLIC_LINK_FLAG_DIRECTORY): Define if not defined in system headers (most versions of MinGW w32api don't). (get_security_info, create_symbolic_link) (get_file_security_desc_by_handle, is_symlink, chase_symlinks): New functions. (sys_access, sys_chmod): Call 'chase_symlinks' to resolve symlinks in the argument file name. (sys_access): Call unc_volume_file_attributes only if GetFileAttributes fails with network-related error codes. (sys_rename): Diagnose renaming of a symlink when the user doesn't have the required privileges. (get_file_security_desc_by_name): Renamed from get_file_security_desc. (stat_worker): New function, with most of the guts of 'stat', and with addition of handling of symlinks and support for 'lstat'. If possible, get file's attributes and security information by handle, not by name. Produce S_IFLNK bit for symlinks, when called from 'lstat'. (stat, lstat): New functions, call 'stat_worker'. (symlink, readlink, careadlinkat): Rewritten to create and resolve symlinks when the underlying filesystem supports them. lib/src/ntlib.c (lstat): New function, calls 'stat'. nt/inc/sys/stat.h (S_IFLNK): Define. (S_ISLNK): A non-trivial definition. (lstat): Prototype instead of a macro that redirects to 'stat'. lisp/files.el (file-truename): Don't skip symlink-chasing part on windows-nt. Incorporate the resolution of 8+3 short aliases on Windows into the loop that recursively chases symlinks. Compare directory and its parent case-insensitively on MS-Windows and MS-DOS. etc/NEWS: Announce the symlink support on MS-Windows. --- lib-src/ChangeLog | 4 ++++ lib-src/ntlib.c | 6 ++++++ 2 files changed, 10 insertions(+) (limited to 'lib-src') diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 955f8cd0330..c98d377f199 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,7 @@ +2012-08-03 Eli Zaretskii + + * ntlib.c (lstat): New function, calls 'stat'. + 2012-08-02 Paul Eggert Use C99-style 'extern inline' if available. diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index d3b001c157c..7b41941ab14 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c @@ -374,3 +374,9 @@ stat (const char * path, struct stat * buf) return 0; } +int +lstat (const char * path, struct stat * buf) +{ + return stat (path, buf); +} + -- cgit v1.2.1