summaryrefslogtreecommitdiff
path: root/lib/openat-die.c
Commit message (Collapse)AuthorAgeFilesLines
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* * lib/openat-die.c (openat_save_fail): Modernize comment.Paul Eggert2011-07-121-1/+1
|
* maint: adjust cpp indentation to reflect nesting depthJim Meyering2011-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | I.e., in a block of code that begins with an unnested "#if", put one space between the "#" in column 1 and following token. For example, -#include <sys/vfs.h> +# include <sys/vfs.h> Do this only in .c files that are part of a module I maintain. * lib/linkat.c: Filter through cppi. * lib/nanosleep.c: Likewise. * lib/openat.c: Likewise. * lib/openat-die.c: Likewise. * lib/dup3.c: Likewise. * lib/fchownat.c: Likewise. * lib/flock.c: Likewise. * lib/fsync.c: Likewise. * lib/fts.c: Likewise. * lib/getpass.c: Likewise. * lib/gettimeofday.c: Likewise. * lib/userspec.c: Likewise. * Makefile (sc_cpp_indent_check): New rule, to check this.
* libposix: Add _HEADERS primaries to posix modules.Bruce Korb2011-02-051-1/+7
| | | | | | Modify gnulib-tool to strip them from generated Makefile.am-s where they are not needed. Also, replace M4 macro prefixes when requested. Finally, omit calls to error() for libposix.
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-2/+2
|
* openat: allow return of fd 0Eric Blake2009-09-191-0/+5
| | | | | | | | | | | | | | | | | | | | | | | Partially reverts patch fc33350 from 2009-09-02. * modules/chdir-long (Depends-on): Relax openat-safer to openat. * modules/save-cwd (Depends-on): Replace fcntl-safer with unistd-safer. * lib/chdir-long.c (includes): Replace "fcntl--.h" with <fcntl.h>; this module does not leak fds. * lib/openat.c (includes): Do not use "fcntl_safer"; plain openat must be allowed to return 0, leaving openat_safer to add the safety. (openat_permissive): Avoid writing to just-opened fd 2 if restoring the current directory fails. * lib/openat-die.c (openat_restore_fail): Add comment. * lib/save-cwd.c (includes): Make "fcntl--.h" conditional. (save_cwd): Guarantee safe fd, but without use of open_safer. * tests/test-openat.c: New test. * modules/openat-tests (Files, Makefile.am): Distribute and build new file. Signed-off-by: Eric Blake <ebb9@byu.net>
* avoid gcc warnings about unused macro definitionsJim Meyering2009-03-121-2/+1
| | | | | | | | | | | | * lib/readtokens.c (STREQ): Remove unused definition. * lib/xmalloc.c (SIZE_MAX): Likewise. * lib/openat-die.c (N_): Likewise. * lib/mountlist.c (SIZE_MAX): Remove definition. Instead, include <stdint.h>. * lib/readutmp.c: Likewise. * modules/readutmp (Depends-on): Add stdint. * modules/mountlist (Depends-on): Add stdint. * lib/userspec.c (ISDIGIT): Move definition into #if block where used.
* Avoid a compilation error on mingw.Bruno Haible2008-10-191-4/+4
|
* openat-die.c: avoid 'no previous prototype' warningJim Meyering2008-10-161-1/+3
| | | | | * lib/openat-die.c: Include "openat.h". Reported by Reuben Thomas <rrt@sc3d.org>.
* Change copyright notice from GPLv2+ to GPLv3+.Bruno Haible2007-10-071-5/+4
|
* * _fpending.c: Include <config.h> unconditionally, since we noPaul Eggert2006-09-131-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | longer worry about uses that don't define HAVE_CONFIG_H. * acl.c, alloca.c, argmatch.c, atexit.c, backupfile.c: * basename.c, c-stack.c, c-strtod.c, calloc.c, canon-host.c: * canonicalize.c, chdir-long.c, chdir-safer.c, chown.c: * cloexec.c, close-stream.c, closeout.c, creat-safer.c: * cycle-check.c, diacrit.c, dirchownmod.c, dirfd.c, dirname.c: * dup-safer.c, dup2.c, error.c, euidaccess.c, exclude.c: * exitfail.c, fchmodat.c, fchown-stub.c, fd-safer.c: * file-type.c, fileblocks.c, filemode.c, filenamecat.c: * fnmatch.c, fopen-safer.c, fprintftime.c, free.c, fsusage.c: * ftruncate.c, fts-cycle.c, fts.c, full-write.c, gai_strerror.c: * getcwd.c, getdate.y, getdomainname.c, getgroups.c: * gethostname.c, gethrxtime.c, getloadavg.c, getlogin_r.c: * getndelim2.c, getnline.c, getopt.c, getopt1.c, getpass.c: * gettime.c, gettimeofday.c, getugroups.c, getusershell.c: * glob.c, group-member.c, hard-locale.c, hash-pjw.c, hash.c: * human.c, idcache.c, inet_ntop.c, inet_pton.c, inttostr.c: * isdir.c, lchown.c, linebuffer.c, long-options.c, lstat.c: * malloc.c, md5.c, memcasecmp.c, memchr.c, memcmp.c, memcoll.c: * memcpy.c, memmove.c, memrchr.c, mkancesdirs.c, mkdir-p.c: * mkdir.c, mkdirat.c, mkstemp-safer.c, mkstemp.c, modechange.c: * mountlist.c, nanosleep.c, obstack.c, open-safer.c: * openat-die.c, openat.c, pagealign_alloc.c, physmem.c: * pipe-safer.c, posixtm.c, posixver.c, putenv.c, quote.c: * quotearg.c, raise.c, readtokens.c, readtokens0.c, readutmp.c: * realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c, safe-read.c: * same.c, save-cwd.c, savedir.c, setenv.c, settime.c, sha1.c: * sig2str.c, snprintf.c, strdup.c, strerror.c, strftime.c: * stripslash.c, strndup.c, strnlen.c, strpbrk.c, strtod.c: * strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c: * timegm.c, tmpfile-safer.c, unlinkdir.c, userspec.c, utime.c: * utimecmp.c, utimens.c, version-etc-fsf.c, version-etc.c: * xalloc-die.c, xgetcwd.c, xgethostname.c, xmalloc.c: * xmemcoll.c, xnanosleep.c, xreadlink.c, xstrtod.c: * xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c: Likewise.
* Sync from coreutils.Paul Eggert2005-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/.cppi-disable: Add getaddrinfo.h, getdelim.h, getline.h, getpass.c mbchar.h, mbuiter.h, strcase.h, strnlen.h, strnlen1.h. * lib/.cvsignore: Add fts.h, search.h, t-fpending. * lib/settime.c (settime): Fix { typo in previous patch. Also, don't bother returning ENOSYS if settimeofday or stime fails; just let them return whatever errno they want to return. * lib/utimens.c: Include unistd.h, for dup2. (futimens): Fix typo: HAVE_FUTIMESAT was misspelled in an #if. (futimens) [! HAVE_FUTIMESAT]: If !file, set errno before returning -1. * lib/fts-cycle.c [HAVE_CONFIG_H]: Include <config.h>. * lib/openat-die.c: Use `#ifdef HAVE_CONFIG_H', not `#if HAVE_CONFIG_H'. * lib/openat.c (fdopendir): Do not define if HAVE_FDOPENDIR. Remove AT_FDCWD test. Do not consume the fd unless successful. * lib/openat.h (fdopendir): Do not define if HAVE_FDOPENDIR. * lib/settime.c (settime): Move the HAVE_STIME block `up' into an #elif block, so that we don't even try to compile it if settimeofday is available. This works around a compilation failure on OSF1 V5.1, due to stime requiring a `long int*' while tv_sec is `int'. * m4/openat.m4 (gl_FUNC_OPENAT): Check for fdopendir. * m4/ullong_max.m4 (gl_ULLONG_MAX): Simplify so that it merely defines ULONG_MAX_LT_ULLONG_MAX. Thomas M.Ott reports that ULLONG_MAX doesn't work with 2.7.2.1. * m4/utimes.m4 (gl_FUNC_UTIMES): Detect the version of utimes from glibc-2.2.5 that fails for read-only files. * m4/chdir-long.m4 (gl_FUNC_CHDIR_LONG): Compare $gl_have_path... against `yes', rather than just testing for nonempty.
* * modules/openat (Files): Add lib/openat-die.c.Paul Eggert2005-09-221-0/+53
(Depends-on): Remove error, exitfail. Add dirname. * lib/openat.c (fdopendir): Be sure to close the supplied file descriptor before returning. This makes our replacement implementation a little closer to Solaris's, where fdopendir ties the file descriptor to the returned DIR* pointer. * lib/openat.c (unlinkat): New function. * lib/openat.h (unlinkat): Add prototype. * lib/openat-die.c (openat_save_fail): Rename from openat_save_die. (openat_restore_fail): Rename from openat_restore_die. * lib/openat.c, openat.h: Reflect s/_die/_fail/ renaming. Provide an alternative to exiting immediately upon save_cwd or restore_cwd failure. Now, an application can arrange e.g., to perform a longjump in that case. * lib/openat.c: Include dirname.h. Use IS_ABSOLUTE_FILE_NAME rather than testing for leading slash. (rpl_openat, fdopendir, fstatat): Call openat_save_die and openat_restore_die rather than calling error directly. Don't include "error.h" or "exitfail.h"; they're no longer needed. * lib/openat-die.c (openat_save_die, openat_restore_die): New file. * lib/openat.h (openat_save_die, openat_restore_die): Declare and define. * m4/openat.m4 (gl_FUNC_OPENAT): Add openat-die.c.