* lib/c-stack.c (ENOTSUP): <errno.h> guarantees a definition.
* lib/canonicalize-lgpl.c (ENAMETOOLONG): Likewise.
* lib/canonicalize.c (ELOOP): Likewise.
* lib/inet_ntop.c (EAFNOSUPPORT): Likewise.
* lib/inet_pton.c (EAFNOSUPPORT): Likewise.
* lib/lchown.c (EOPNOTSUPP): Likewise.
* lib/openat-priv.h (ENOSYS, EOPNOTSUPP): Likewise.
* lib/savewd.c (ESTALE): Likewise.
* lib/settime.c (ENOSYS): Likewise.
* lib/utimens.c (ENOSYS): Likewise.
* lib/xgethostname.c (ENAMETOOLONG): Likewise.
* lib/chdir-safer.c (ELOOP): Likewise.
(chdir_no_follow): Use HAVE_READLINK, not ELOOP, as witness.
* modules/c-stack (Depends-on): Add errno.
* modules/canonicalize (Depends-on): Likewise.
* modules/chdir-safer (Depends-on): Likewise.
* modules/fdopendir (Depends-on): Likewise.
* modules/inet_ntop (Depends-on): Likewise.
* modules/inet_pton (Depends-on): Likewise.
* modules/lchown (Depends-on): Likewise.
* modules/openat (Depends-on): Likewise.
* modules/savewd (Depends-on): Likewise.
* modules/settime (Depends-on): Likewise.
* m4/chdir-safer.m4 (gl_CHDIR_SAFER): Check for readlink.
Signed-off-by: Eric Blake <ebb9@byu.net>
2009-09-02 Eric Blake <ebb9@byu.net>
+ errno: use consistently
+ * lib/c-stack.c (ENOTSUP): <errno.h> guarantees a definition.
+ * lib/canonicalize-lgpl.c (ENAMETOOLONG): Likewise.
+ * lib/canonicalize.c (ELOOP): Likewise.
+ * lib/inet_ntop.c (EAFNOSUPPORT): Likewise.
+ * lib/inet_pton.c (EAFNOSUPPORT): Likewise.
+ * lib/lchown.c (EOPNOTSUPP): Likewise.
+ * lib/openat-priv.h (ENOSYS, EOPNOTSUPP): Likewise.
+ * lib/savewd.c (ESTALE): Likewise.
+ * lib/settime.c (ENOSYS): Likewise.
+ * lib/utimens.c (ENOSYS): Likewise.
+ * lib/xgethostname.c (ENAMETOOLONG): Likewise.
+ * lib/chdir-safer.c (ELOOP): Likewise.
+ (chdir_no_follow): Use HAVE_READLINK, not ELOOP, as witness.
+ * modules/c-stack (Depends-on): Add errno.
+ * modules/canonicalize (Depends-on): Likewise.
+ * modules/chdir-safer (Depends-on): Likewise.
+ * modules/fdopendir (Depends-on): Likewise.
+ * modules/inet_ntop (Depends-on): Likewise.
+ * modules/inet_pton (Depends-on): Likewise.
+ * modules/lchown (Depends-on): Likewise.
+ * modules/openat (Depends-on): Likewise.
+ * modules/savewd (Depends-on): Likewise.
+ * modules/settime (Depends-on): Likewise.
+ * m4/chdir-safer.m4 (gl_CHDIR_SAFER): Check for readlink.
+
fts: avoid leaking fds
* modules/fts (Depends-on): Add cloexec.
* lib/fts.c (opendirat, diropen, fts_build): Set close-on-exec
#define _(msgid) gettext (msgid)
#include <errno.h>
-#ifndef ENOTSUP
-# define ENOTSUP EINVAL
-#endif
#include <signal.h>
#if ! HAVE_STACK_T && ! defined stack_t
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2003, 2005-2008 Free Software Foundation, Inc.
+ Copyright (C) 1996-2003, 2005-2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
#include <errno.h>
#ifndef _LIBC
# define __set_errno(e) errno = (e)
-# ifndef ENAMETOOLONG
-# define ENAMETOOLONG EINVAL
-# endif
#endif
#ifdef _LIBC
#include "xalloc.h"
#include "xgetcwd.h"
-#ifndef ELOOP
-# define ELOOP 0
-#endif
#ifndef __set_errno
# define __set_errno(Val) errno = (Val)
#endif
/* much like chdir(2), but safer
- Copyright (C) 2005-2006, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <sys/stat.h>
#include "same-inode.h"
-#ifndef ELOOP
-# define ELOOP 0
+#ifndef HAVE_READLINK
+# define HAVE_READLINK 0
#endif
/* Like chdir, but fail if DIR is a symbolic link to a directory (or
they are the same file; if they are different files, set errno to
ELOOP (the same value that open uses for symlinks with
O_NOFOLLOW) so the caller can report a failure.
- Skip this check if ELOOP == 0, which should be the case
+ Skip this check if HAVE_READLINK == 0, which should be the case
on any system that lacks symlink support. */
- if (ELOOP && ! HAVE_WORKING_O_NOFOLLOW)
+ if (HAVE_READLINK && ! HAVE_WORKING_O_NOFOLLOW)
{
struct stat sb1;
result = lstat (dir, &sb1);
/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
- Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <string.h>
#include <errno.h>
-#ifndef EAFNOSUPPORT
-# define EAFNOSUPPORT EINVAL
-#endif
-
#define NS_IN6ADDRSZ 16
#define NS_INT16SZ 2
/* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form
- Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <string.h>
#include <errno.h>
-#ifndef EAFNOSUPPORT
-# define EAFNOSUPPORT EINVAL
-#endif
-
#define NS_INADDRSZ 4
#define NS_IN6ADDRSZ 16
#define NS_INT16SZ 2
#include <errno.h>
#include <sys/stat.h>
-/* Some systems don't have EOPNOTSUPP. */
-#ifndef EOPNOTSUPP
-# ifdef ENOTSUP
-# define EOPNOTSUPP ENOTSUP
-# else
-/* Some systems don't have ENOTSUP either. */
-# define EOPNOTSUPP EINVAL
-# endif
-#endif
-
/* Work just like chown, except when FILE is a symbolic link.
In that case, set errno to EOPNOTSUPP and return -1.
But if autoconf tests determined that chown modifies
/* Internals for openat-like functions.
- Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define OPENAT_BUFFER_SIZE 512
char *openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file);
-/* Some systems don't have ENOSYS. */
-#ifndef ENOSYS
-# ifdef ENOTSUP
-# define ENOSYS ENOTSUP
-# else
-/* Some systems don't have ENOTSUP either. */
-# define ENOSYS EINVAL
-# endif
-#endif
-
-/* Some systems don't have EOPNOTSUPP. */
-#ifndef EOPNOTSUPP
-# ifdef ENOTSUP
-# define EOPNOTSUPP ENOTSUP
-# else
-/* Some systems don't have ENOTSUP either. */
-# define EOPNOTSUPP EINVAL
-# endif
-#endif
-
/* Trying to access a BUILD_PROC_NAME file will fail on systems without
/proc support, and even on systems *with* ProcFS support. Return
nonzero if the failure may be legitimate, e.g., because /proc is not
/* Save and restore the working directory, possibly using a child process.
- Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "dirname.h"
#include "fcntl-safer.h"
-#ifndef ESTALE
-# define ESTALE -1
-#endif
-
/* Save the working directory into *WD, if it hasn't been saved
already. Return true if a child has been forked to do the real
work. */
/* settime -- set the system clock
- Copyright (C) 2002, 2004, 2005, 2006, 2007 Free Software
+ Copyright (C) 2002, 2004, 2005, 2006, 2007, 2009 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
#include <errno.h>
-/* Some systems don't have ENOSYS. */
-#ifndef ENOSYS
-# ifdef ENOTSUP
-# define ENOSYS ENOTSUP
-# else
-/* Some systems don't have ENOTSUP either. */
-# define ENOSYS EINVAL
-# endif
-#endif
-
/* Set the system time. */
int
/* Set file access and modification times.
- Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software
- Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
+ Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
};
#endif
-/* Some systems don't have ENOSYS. */
-#ifndef ENOSYS
-# ifdef ENOTSUP
-# define ENOSYS ENOTSUP
-# else
-/* Some systems don't have ENOTSUP either. */
-# define ENOSYS EINVAL
-# endif
-#endif
-
#ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
# define __attribute__(x)
/* xgethostname.c -- return current hostname with unlimited length
- Copyright (C) 1992, 1996, 2000, 2001, 2003, 2004, 2005, 2006 Free
- Software Foundation, Inc.
+ Copyright (C) 1992, 1996, 2000, 2001, 2003, 2004, 2005, 2006, 2009
+ Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "xalloc.h"
-#ifndef ENAMETOOLONG
-# define ENAMETOOLONG 0
-#endif
-
#ifndef INITIAL_HOSTNAME_LENGTH
# define INITIAL_HOSTNAME_LENGTH 34
#endif
-#serial 3
-dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+#serial 4
+dnl Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_CHDIR_SAFER],
[
AC_LIBOBJ([chdir-safer])
+ AC_CHECK_FUNCS_ONCE([readlink])
])
Depends-on:
gettext-h
+errno
exitfail
unistd
raise
Depends-on:
areadlink-with-size
+errno
file-set
filenamecat
hash-triple
m4/chdir-safer.m4
Depends-on:
+errno
fchdir
fcntl-h
open
m4/fdopendir.m4
Depends-on:
-extensions
dirent
+errno
+extensions
fchdir
openat-die
save-cwd
socklen
sys_socket
arpa_inet
+errno
netinet_in
extensions
socklen
sys_socket
arpa_inet
+errno
netinet_in
extensions
Depends-on:
chown
+errno
sys_stat
unistd
Depends-on:
dirname
+errno
extensions
fchdir
fdopendir
Depends-on:
dirname
+errno
exit
fchdir
fcntl-safer
Depends-on:
clock-time
+errno
extensions
sys_time
timespec
m4/utimes.m4
Depends-on:
+errno
sys_time
time