# HG changeset patch # User Paul Eggert # Date 1514680472 28800 # Node ID 42415f577ccd7cd91a31421c04f224aa0b59c5c4 # Parent a84ae461a2f6a8f82c7d3a50bf75d1aaecbb0649 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. diff -r a84ae461a2f6 -r 42415f577ccd ChangeLog --- 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 + + 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 Add cross-compilation results for GNU/Hurd. diff -r a84ae461a2f6 -r 42415f577ccd MODULES.html.sh --- 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 diff -r a84ae461a2f6 -r 42415f577ccd NEWS --- 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 diff -r a84ae461a2f6 -r 42415f577ccd lib/chdir-safer.c --- 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 . */ - -/* written by Jim Meyering */ - -#include - -#include "chdir-safer.h" - -#include -#include -#include -#include -#include -#include -#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; -} diff -r a84ae461a2f6 -r 42415f577ccd lib/chdir-safer.h --- 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 . */ - -/* Written by Jim Meyering. */ - -int chdir_no_follow (char const *file); diff -r a84ae461a2f6 -r 42415f577ccd m4/afs.m4 --- 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 - ]) diff -r a84ae461a2f6 -r 42415f577ccd m4/chdir-safer.m4 --- 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]) -]) diff -r a84ae461a2f6 -r 42415f577ccd modules/chdir-safer --- 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