aboutsummaryrefslogtreecommitdiffstats
path: root/lib/open.c
diff options
context:
space:
mode:
authorPaul Eggert2019-09-22 23:50:59 -0700
committerPaul Eggert2019-09-22 23:51:44 -0700
commit78669517dc3db4d6d51fb26d71073fc0c196ab5d (patch)
treea3dff006cf177da51fd6458203d8e4751e36e78b /lib/open.c
parenta33cda168e35cb93cdf115f7d12765f590226601 (diff)
downloademacs-78669517dc3db4d6d51fb26d71073fc0c196ab5d.tar.gz
emacs-78669517dc3db4d6d51fb26d71073fc0c196ab5d.zip
Update from Gnulib
This incorporates: 2019-09-22 Update some URLs 2019-09-15 fcntl-h: fix compilation error of creat.c on MSVC 2019-09-15 creat: new module 2019-09-15 access: new module 2019-09-09 Add option to assume best, not worst, when cross-compiling. * build-aux/config.guess, build-aux/config.sub, doc/misc/texinfo.tex: * lib/careadlinkat.c, lib/careadlinkat.h, lib/count-leading-zeros.h: * lib/count-trailing-zeros.h, lib/diffseq.h, lib/fcntl.in.h: * lib/ftoastr.c, lib/get-permissions.c: * lib/ieee754.in.h, lib/inttypes.in.h, lib/mktime.c, lib/open.c: * lib/pathmax.h, lib/pipe2.c, lib/stddef.in.h, lib/stdint.in.h: * lib/stdlib.in.h, lib/str-two-way.h, lib/string.in.h, lib/time.in.h: * lib/timegm.c, lib/unistd.in.h, m4/canonicalize.m4: * m4/extern-inline.m4, m4/fcntl_h.m4, m4/fdopendir.m4: * m4/getgroups.m4, m4/getopt.m4, m4/gettimeofday.m4: * m4/gnulib-common.m4, m4/largefile.m4: * m4/lstat.m4, m4/memmem.m4, m4/mktime.m4, m4/nocrash.m4, m4/open.m4: * m4/pselect.m4, m4/putenv.m4, m4/readlink.m4, m4/regex.m4: * m4/symlink.m4, m4/unistd_h.m4, m4/utimens.m4, m4/utimes.m4: Copy from Gnulib. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * m4/open-slash.m4: New file, copied from Gnulib.
Diffstat (limited to 'lib/open.c')
-rw-r--r--lib/open.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/lib/open.c b/lib/open.c
index 655260572d4..4572ebf6cd2 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -94,20 +94,13 @@ open (const char *filename, int flags, ...)
94#if OPEN_TRAILING_SLASH_BUG 94#if OPEN_TRAILING_SLASH_BUG
95 /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR 95 /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR
96 is specified, then fail. 96 is specified, then fail.
97 Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> 97 Rationale: POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html>
98 says that
99 "A pathname that contains at least one non-slash character and that
100 ends with one or more trailing slashes shall be resolved as if a
101 single dot character ( '.' ) were appended to the pathname."
102 and
103 "The special filename dot shall refer to the directory specified by
104 its predecessor."
105 If the named file already exists as a directory, then 98 If the named file already exists as a directory, then
106 - if O_CREAT is specified, open() must fail because of the semantics 99 - if O_CREAT is specified, open() must fail because of the semantics
107 of O_CREAT, 100 of O_CREAT,
108 - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX 101 - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX
109 <http://www.opengroup.org/susv3/functions/open.html> says that it 102 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html>
110 fails with errno = EISDIR in this case. 103 says that it fails with errno = EISDIR in this case.
111 If the named file does not exist or does not name a directory, then 104 If the named file does not exist or does not name a directory, then
112 - if O_CREAT is specified, open() must fail since open() cannot create 105 - if O_CREAT is specified, open() must fail since open() cannot create
113 directories, 106 directories,
@@ -171,14 +164,6 @@ open (const char *filename, int flags, ...)
171#if OPEN_TRAILING_SLASH_BUG 164#if OPEN_TRAILING_SLASH_BUG
172 /* If the filename ends in a slash and fd does not refer to a directory, 165 /* If the filename ends in a slash and fd does not refer to a directory,
173 then fail. 166 then fail.
174 Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
175 says that
176 "A pathname that contains at least one non-slash character and that
177 ends with one or more trailing slashes shall be resolved as if a
178 single dot character ( '.' ) were appended to the pathname."
179 and
180 "The special filename dot shall refer to the directory specified by
181 its predecessor."
182 If the named file without the slash is not a directory, open() must fail 167 If the named file without the slash is not a directory, open() must fail
183 with ENOTDIR. */ 168 with ENOTDIR. */
184 if (fd >= 0) 169 if (fd >= 0)