1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* unlinkdir.c - determine whether we can unlink directories
5 Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* Written by Paul Eggert, Jim Meyering, and David Bartley. */
24 #include "unlinkdir.h"
28 #if ! UNLINK_CANNOT_UNLINK_DIR
30 /* Return true if we cannot unlink directories, false if we might be
31 able to unlink directories. */
34 cannot_unlink_dir (void)
36 static bool initialized;
41 # if defined PRIV_SYS_LINKDIR
42 /* We might be able to unlink directories if we cannot
43 determine our privileges, or if we have the
44 PRIV_SYS_LINKDIR privilege. */
45 cannot = (priv_set_ismember (PRIV_SYS_LINKDIR) == 0);
47 /* In traditional Unix, only root can unlink directories. */
48 cannot = (geteuid () != 0);