Mercurial > gnulib
changeset 39195:42415f577ccd
chdir-safer: remove this module
* MODULES.html.sh (func_all_modules): Remove chdir-safer.
* NEWS: Document removal.
* lib/chdir-safer.c, lib/chdir-safer.h, m4/afs.m4, m4/chdir-safer.m4:
* modules/chdir-safer: Remove these files.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sat, 30 Dec 2017 16:34:32 -0800 |
parents | a84ae461a2f6 |
children | c9c758400c81 |
files | ChangeLog MODULES.html.sh NEWS lib/chdir-safer.c lib/chdir-safer.h m4/afs.m4 m4/chdir-safer.m4 modules/chdir-safer |
diffstat | 8 files changed, 11 insertions(+), 161 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Dec 29 17:30:07 2017 +0100 +++ b/ChangeLog Sat Dec 30 16:34:32 2017 -0800 @@ -1,3 +1,11 @@ +2017-12-30 Paul Eggert <eggert@cs.ucla.edu> + + chdir-safer: remove this module + * MODULES.html.sh (func_all_modules): Remove chdir-safer. + * NEWS: Document removal. + * lib/chdir-safer.c, lib/chdir-safer.h, m4/afs.m4, m4/chdir-safer.m4: + * modules/chdir-safer: Remove these files. + 2017-12-29 Samuel Thibault <samuel.thibault@gnu.org> Add cross-compilation results for GNU/Hurd.
--- a/MODULES.html.sh Fri Dec 29 17:30:07 2017 +0100 +++ b/MODULES.html.sh Sat Dec 30 16:34:32 2017 -0800 @@ -2652,7 +2652,6 @@ func_module backup-rename func_module canonicalize func_module canonicalize-lgpl - func_module chdir-safer func_module clean-temp func_module concat-filename func_module copy-file
--- a/NEWS Fri Dec 29 17:30:07 2017 +0100 +++ b/NEWS Sat Dec 30 16:34:32 2017 -0800 @@ -42,6 +42,9 @@ Date Modules Changes +2017-12-30 chdir-safer This module is removed. It was deprecated + on 2006-07-17. + 2017-11-24 posixtm Previously, callers had to specify either PDS_LEADING_YEAR or PDS_TRAILING_YEAR (but not both). Now, callers should specify
--- a/lib/chdir-safer.c Fri Dec 29 17:30:07 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* much like chdir(2), but safer - - Copyright (C) 2005-2006, 2008-2017 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 Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. */ - -/* written by Jim Meyering */ - -#include <config.h> - -#include "chdir-safer.h" - -#include <stdbool.h> -#include <fcntl.h> -#include <errno.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include "same-inode.h" - -#ifndef HAVE_READLINK -# define HAVE_READLINK 0 -#endif - -/* Like chdir, but fail if DIR is a symbolic link to a directory (or - similar funny business). This avoids a minor race condition - between when a directory is created or statted and when the process - chdirs into it. - - On older systems lacking full support for O_SEARCH, this function - can also fail if DIR is not readable. */ -int -chdir_no_follow (char const *dir) -{ - int result = 0; - int saved_errno; - int fd = open (dir, - O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NOFOLLOW | O_NONBLOCK); - if (fd < 0) - return -1; - - /* If open follows symlinks, lstat DIR and fstat FD to ensure that - 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 HAVE_READLINK == 0, which should be the case - on any system that lacks symlink support. */ - if (HAVE_READLINK && ! HAVE_WORKING_O_NOFOLLOW) - { - struct stat sb1; - result = lstat (dir, &sb1); - if (result == 0) - { - struct stat sb2; - result = fstat (fd, &sb2); - if (result == 0 && ! SAME_INODE (sb1, sb2)) - { - errno = ELOOP; - result = -1; - } - } - } - - if (result == 0) - result = fchdir (fd); - - saved_errno = errno; - close (fd); - errno = saved_errno; - return result; -}
--- a/lib/chdir-safer.h Fri Dec 29 17:30:07 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -/* much like chdir(2), but safer - - Copyright (C) 2005, 2009-2017 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 Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. */ - -/* Written by Jim Meyering. */ - -int chdir_no_follow (char const *file);
--- a/m4/afs.m4 Fri Dec 29 17:30:07 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -# serial 10 - -# Copyright (C) 1999-2001, 2004, 2008-2017 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_AFS], - [ - AC_ARG_WITH([afs], - AS_HELP_STRING([--with-afs], - [support for the Andrew File System [[default=no]]]), - test "$withval" = no || with_afs=yes, with_afs=no) - if test "$with_afs" = yes; then - AC_DEFINE([AFS], [1], [Define if you have the Andrew File System.]) - fi - ])
--- a/m4/chdir-safer.m4 Fri Dec 29 17:30:07 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#serial 5 -dnl Copyright (C) 2005-2006, 2009-2017 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_CHECK_FUNCS_ONCE([readlink]) -])
--- a/modules/chdir-safer Fri Dec 29 17:30:07 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -Description: -like chdir, but safer - -Files: -lib/chdir-safer.h -lib/chdir-safer.c -m4/chdir-safer.m4 - -Depends-on: -errno -fchdir -fcntl-h -fstat -open -same-inode -stdbool - -configure.ac: -gl_CHDIR_SAFER - -Makefile.am: -lib_SOURCES += chdir-safer.c - -Include: -"chdir-safer.h" - -License: -GPL - -Maintainer: -Jim Meyering