[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r110896: MS-Windows followup for revi
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r110896: MS-Windows followup for revision 110889, regarding faccessat. |
Date: |
Wed, 14 Nov 2012 19:22:55 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110896
fixes bug: http://debbugs.gnu.org/12632
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Wed 2012-11-14 19:22:55 +0200
message:
MS-Windows followup for revision 110889, regarding faccessat.
nt/inc/unistd.h (faccessat): Add prototype.
(AT_FDCWD, AT_EACCESS, AT_SYMLINK_NOFOLLOW): New macros; the first
2 moved from ms-w32.h.
nt/inc/ms-w32.h (AT_FDCWD, AT_EACCESS, faccessat): Remove macros.
src/w32.c (faccessat): Rename from sys_faccessat. (No need to use a
different name, as the MS runtime does not have such a function,
and probably never will.) All callers changed. Ignore DIRFD
value if PATH is an absolute file name, to match Posix spec
better. If AT_SYMLINK_NOFOLLOW is set in FLAGS, don't resolve
symlinks.
modified:
nt/ChangeLog
nt/inc/ms-w32.h
nt/inc/unistd.h
src/ChangeLog
src/w32.c
=== modified file 'nt/ChangeLog'
--- a/nt/ChangeLog 2012-11-14 04:55:41 +0000
+++ b/nt/ChangeLog 2012-11-14 17:22:55 +0000
@@ -1,3 +1,11 @@
+2012-11-14 Eli Zaretskii <address@hidden>
+
+ * inc/unistd.h (faccessat): Add prototype.
+ (AT_FDCWD, AT_EACCESS, AT_SYMLINK_NOFOLLOW): New macros; the first
+ 2 moved from ms-w32.h.
+
+ * inc/ms-w32.h (AT_FDCWD, AT_EACCESS, faccessat): Remove macros.
+
2012-11-14 Paul Eggert <address@hidden>
Use faccessat, not access, when checking file permissions (Bug#12632).
=== modified file 'nt/inc/ms-w32.h'
--- a/nt/inc/ms-w32.h 2012-11-14 04:55:41 +0000
+++ b/nt/inc/ms-w32.h 2012-11-14 17:22:55 +0000
@@ -124,10 +124,6 @@
#define MAXPATHLEN _MAX_PATH
#endif
-/* Use values compatible with gnulib, as there's no reason to differ. */
-#define AT_FDCWD (-3041965)
-#define AT_EACCESS 4
-
#ifdef HAVE_NTGUI
#define HAVE_WINDOW_SYSTEM 1
#define HAVE_MENUS 1
@@ -163,7 +159,6 @@
#define dup sys_dup
#undef dup2
#define dup2 sys_dup2
-#define faccessat sys_faccessat
#define fopen sys_fopen
#define link sys_link
#define localtime sys_localtime
=== modified file 'nt/inc/unistd.h'
--- a/nt/inc/unistd.h 2012-11-05 17:29:30 +0000
+++ b/nt/inc/unistd.h 2012-11-14 17:22:55 +0000
@@ -18,4 +18,12 @@
extern pid_t setsid (void);
extern pid_t tcgetpgrp (int);
+extern int faccessat (int, char const *, int, int);
+
+/* These are normally on fcntl.h, but we don't override that header. */
+/* Use values compatible with gnulib, as there's no reason to differ. */
+#define AT_FDCWD (-3041965)
+#define AT_EACCESS 4
+#define AT_SYMLINK_NOFOLLOW 4096
+
#endif /* _UNISTD_H */
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-11-14 11:13:33 +0000
+++ b/src/ChangeLog 2012-11-14 17:22:55 +0000
@@ -1,3 +1,12 @@
+2012-11-14 Eli Zaretskii <address@hidden>
+
+ * w32.c (faccessat): Rename from sys_faccessat. (No need to use a
+ different name, as the MS runtime does not have such a function,
+ and probably never will.) All callers changed. Ignore DIRFD
+ value if PATH is an absolute file name, to match Posix spec
+ better. If AT_SYMLINK_NOFOLLOW is set in FLAGS, don't resolve
+ symlinks.
+
2012-11-14 Dmitry Antipov <address@hidden>
* xdisp.c (echo_area_display, redisplay_internal):
=== modified file 'src/w32.c'
--- a/src/w32.c 2012-11-14 04:55:41 +0000
+++ b/src/w32.c 2012-11-14 17:22:55 +0000
@@ -1597,7 +1597,7 @@
see if it succeeds. But I think that's too much to ask. */
/* MSVCRT's _access crashes with D_OK. */
- if (tmp && sys_faccessat (AT_FDCWD, tmp, D_OK, AT_EACCESS) == 0)
+ if (tmp && faccessat (AT_FDCWD, tmp, D_OK, AT_EACCESS) == 0)
{
char * var = alloca (strlen (tmp) + 8);
sprintf (var, "TMPDIR=%s", tmp);
@@ -2708,17 +2708,15 @@
WNetAddConnection2 (&resource, NULL, NULL, CONNECT_INTERACTIVE);
}
-/* Shadow some MSVC runtime functions to map requests for long filenames
- to reasonable short names if necessary. This was originally added to
- permit running Emacs on NT 3.1 on a FAT partition, which doesn't support
- long file names. */
-
+/* Emulate faccessat(2). */
int
-sys_faccessat (int dirfd, const char * path, int mode, int flags)
+faccessat (int dirfd, const char * path, int mode, int flags)
{
DWORD attributes;
- if (dirfd != AT_FDCWD)
+ if (dirfd != AT_FDCWD
+ && !(IS_DIRECTORY_SEP (path[0])
+ || IS_DEVICE_SEP (path[1])))
{
errno = EBADF;
return -1;
@@ -2731,7 +2729,8 @@
to get the attributes of its target file. Note: any symlinks in
PATH elements other than the last one are transparently resolved
by GetFileAttributes below. */
- if ((volume_info.flags & FILE_SUPPORTS_REPARSE_POINTS) != 0)
+ if ((volume_info.flags & FILE_SUPPORTS_REPARSE_POINTS) != 0
+ && (flags & AT_SYMLINK_NOFOLLOW) == 0)
path = chase_symlinks (path);
if ((attributes = GetFileAttributes (path)) == -1)
@@ -2781,6 +2780,11 @@
return 0;
}
+/* Shadow some MSVC runtime functions to map requests for long filenames
+ to reasonable short names if necessary. This was originally added to
+ permit running Emacs on NT 3.1 on a FAT partition, which doesn't support
+ long file names. */
+
int
sys_chdir (const char * path)
{
@@ -2966,7 +2970,7 @@
{
int save_errno = errno;
p[0] = first_char[i];
- if (sys_faccessat (AT_FDCWD, template, F_OK, AT_EACCESS) < 0)
+ if (faccessat (AT_FDCWD, template, F_OK, AT_EACCESS) < 0)
{
errno = save_errno;
return template;
@@ -4017,7 +4021,7 @@
{
/* Non-absolute FILENAME is understood as being relative to
LINKNAME's directory. We need to prepend that directory to
- FILENAME to get correct results from sys_faccessat below, since
+ FILENAME to get correct results from faccessat below, since
otherwise it will interpret FILENAME relative to the
directory where the Emacs process runs. Note that
make-symbolic-link always makes sure LINKNAME is a fully
@@ -4031,10 +4035,10 @@
strncpy (tem, linkfn, p - linkfn);
tem[p - linkfn] = '\0';
strcat (tem, filename);
- dir_access = sys_faccessat (AT_FDCWD, tem, D_OK, AT_EACCESS);
+ dir_access = faccessat (AT_FDCWD, tem, D_OK, AT_EACCESS);
}
else
- dir_access = sys_faccessat (AT_FDCWD, filename, D_OK, AT_EACCESS);
+ dir_access = faccessat (AT_FDCWD, filename, D_OK, AT_EACCESS);
/* Since Windows distinguishes between symlinks to directories and
to files, we provide a kludgy feature: if FILENAME doesn't
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r110896: MS-Windows followup for revision 110889, regarding faccessat.,
Eli Zaretskii <=