aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2012-10-19 09:52:02 -0700
committerPaul Eggert2012-10-19 09:52:02 -0700
commite752e0b0a2622d8d0ba518bf81f6fa652d926e67 (patch)
tree3b7cfbf8aa3ecaa587cd6fbc2d17b64d055d2b07 /lib
parent6ec83f926d5ff699901fb530162d7f1bdfa85808 (diff)
downloademacs-e752e0b0a2622d8d0ba518bf81f6fa652d926e67.tar.gz
emacs-e752e0b0a2622d8d0ba518bf81f6fa652d926e67.zip
Use faccessat, not access, when checking file permissions.
* .bzrignore: Add lib/fcntl.h. * configure.ac (euidaccess): Remove check; gnulib does this for us now. (gl_FCNTL_O_FLAGS): Define a dummy version. * lib/at-func.c, lib/euidaccess.c, lib/faccessat.c, lib/fcntl.in.h: * lib/getgroups.c, lib/group-member.c, lib/root-uid.h: * lib/xalloc-oversized.h, m4/euidaccess.m4, m4/faccessat.m4: * m4/fcntl_h.m4, m4/getgroups.m4, m4/group-member.m4: New files, from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * admin/merge-gnulib (GNULIB_MODULES): Add faccessat. (GNULIB_TOOL_FLAGS): Avoid at-internal, fchdir, malloc-posix, openat-die, openat-h, save-cwd. Do not avoid fcntl-h. Omit gnulib's m4/fcntl-o.m4. * nt/inc/ms-w32.h (AT_FDCWD, AT_EACCESS): New symbols. (access): Remove. (faccessat): New macro. * src/Makefile.in (LIB_EACCESS): New macro. (LIBES): Use it. * src/callproc.c (init_callproc): * src/charset.c (init_charset): * src/fileio.c (check_existing, check_executable): * src/lread.c (openp, load_path_check): * src/process.c (allocate_pty): * src/xrdb.c (file_p): Use faccessat, not access or euidaccess. Use symbolic names instead of integers for the flags, as they're portable now. * src/charset.c, src/xrdb.c: Include <fcntl.h>, for the new flags used. * src/fileio.c (Ffile_readable_p): Use faccessat, not stat + open + close. (file_directory_p): New function, which uses 'stat' on most places but 'access' (for efficiency) if WINDOWSNT. * src/fileio.c (Ffile_directory_p, Fset_file_times): * src/xrdb.c (file_p): Use file_directory_p. * src/lisp.h (file_directory_p): New decl. * src/lread.c (openp): When opening a file, use fstat rather than stat, as that avoids a permissions race. When not opening a file, use file_directory_p rather than stat. * src/process.c, src/sysdep.c, src/term.c: All uses of '#ifdef O_NONBLOCK' changed to '#if O_NONBLOCK', to accommodate gnulib O_* tyle. * src/w32.c (sys_faccessat): Rename from sys_access and switch to faccessat's API. All uses changed. Fixes: debbugs:12632
Diffstat (limited to 'lib')
-rw-r--r--lib/gnulib.mk97
1 files changed, 96 insertions, 1 deletions
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 23749331a83..d2562a4dae1 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -21,7 +21,7 @@
21# the same distribution terms as the rest of that program. 21# the same distribution terms as the rest of that program.
22# 22#
23# Generated by gnulib-tool. 23# Generated by gnulib-tool.
24# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings 24# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=at-internal --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=openat-h --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings
25 25
26 26
27MOSTLYCLEANFILES += core *.stackdump 27MOSTLYCLEANFILES += core *.stackdump
@@ -150,6 +150,17 @@ EXTRA_libgnu_a_SOURCES += dup2.c
150 150
151## end gnulib module dup2 151## end gnulib module dup2
152 152
153## begin gnulib module euidaccess
154
155if gl_GNULIB_ENABLED_euidaccess
156
157endif
158EXTRA_DIST += euidaccess.c
159
160EXTRA_libgnu_a_SOURCES += euidaccess.c
161
162## end gnulib module euidaccess
163
153## begin gnulib module execinfo 164## begin gnulib module execinfo
154 165
155BUILT_SOURCES += $(EXECINFO_H) 166BUILT_SOURCES += $(EXECINFO_H)
@@ -175,6 +186,50 @@ EXTRA_libgnu_a_SOURCES += execinfo.c
175 186
176## end gnulib module execinfo 187## end gnulib module execinfo
177 188
189## begin gnulib module faccessat
190
191
192EXTRA_DIST += at-func.c faccessat.c
193
194EXTRA_libgnu_a_SOURCES += at-func.c faccessat.c
195
196## end gnulib module faccessat
197
198## begin gnulib module fcntl-h
199
200BUILT_SOURCES += fcntl.h
201
202# We need the following in order to create <fcntl.h> when the system
203# doesn't have one that works with the given compiler.
204fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
205 $(AM_V_GEN)rm -f $@-t $@ && \
206 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
207 sed -e 's|@''GUARD_PREFIX''@|GL|g' \
208 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
209 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
210 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
211 -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
212 -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \
213 -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \
214 -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \
215 -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \
216 -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \
217 -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \
218 -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \
219 -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
220 -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \
221 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
222 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
223 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
224 < $(srcdir)/fcntl.in.h; \
225 } > $@-t && \
226 mv $@-t $@
227MOSTLYCLEANFILES += fcntl.h fcntl.h-t
228
229EXTRA_DIST += fcntl.in.h
230
231## end gnulib module fcntl-h
232
178## begin gnulib module filemode 233## begin gnulib module filemode
179 234
180libgnu_a_SOURCES += filemode.c 235libgnu_a_SOURCES += filemode.c
@@ -183,6 +238,17 @@ EXTRA_DIST += filemode.h
183 238
184## end gnulib module filemode 239## end gnulib module filemode
185 240
241## begin gnulib module getgroups
242
243if gl_GNULIB_ENABLED_getgroups
244
245endif
246EXTRA_DIST += getgroups.c
247
248EXTRA_libgnu_a_SOURCES += getgroups.c
249
250## end gnulib module getgroups
251
186## begin gnulib module getloadavg 252## begin gnulib module getloadavg
187 253
188 254
@@ -242,6 +308,17 @@ EXTRA_libgnu_a_SOURCES += gettimeofday.c
242 308
243## end gnulib module gettimeofday 309## end gnulib module gettimeofday
244 310
311## begin gnulib module group-member
312
313if gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1
314
315endif
316EXTRA_DIST += group-member.c
317
318EXTRA_libgnu_a_SOURCES += group-member.c
319
320## end gnulib module group-member
321
245## begin gnulib module ignore-value 322## begin gnulib module ignore-value
246 323
247 324
@@ -354,6 +431,15 @@ EXTRA_libgnu_a_SOURCES += readlink.c
354 431
355## end gnulib module readlink 432## end gnulib module readlink
356 433
434## begin gnulib module root-uid
435
436if gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c
437
438endif
439EXTRA_DIST += root-uid.h
440
441## end gnulib module root-uid
442
357## begin gnulib module signal-h 443## begin gnulib module signal-h
358 444
359BUILT_SOURCES += signal.h 445BUILT_SOURCES += signal.h
@@ -1312,6 +1398,15 @@ EXTRA_DIST += verify.h
1312 1398
1313## end gnulib module verify 1399## end gnulib module verify
1314 1400
1401## begin gnulib module xalloc-oversized
1402
1403if gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec
1404
1405endif
1406EXTRA_DIST += xalloc-oversized.h
1407
1408## end gnulib module xalloc-oversized
1409
1315 1410
1316mostlyclean-local: mostlyclean-generic 1411mostlyclean-local: mostlyclean-generic
1317 @for dir in '' $(MOSTLYCLEANDIRS); do \ 1412 @for dir in '' $(MOSTLYCLEANDIRS); do \