X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fwrite-any-file.c;h=8492ac811311d1a22ff39ac432d4ea22a50ed907;hb=793245ab8245323201d23f435d9cc5464bb02e76;hp=d0161777c4a4bc91c0bd143b3555a3ef35ab90e2;hpb=6bfbb0d1d8f2818625bbf0cd3c4010f9c6d53ebd;p=gnulib.git diff --git a/lib/write-any-file.c b/lib/write-any-file.c index d0161777c..8492ac811 100644 --- a/lib/write-any-file.c +++ b/lib/write-any-file.c @@ -2,10 +2,10 @@ Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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 2, or (at your option) - any later version. + 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 @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* Written by Paul Eggert. */ @@ -34,10 +33,11 @@ bool can_write_any_file (void) { static bool initialized; - static bool can; + static bool can_write; if (! initialized) { + bool can = false; #if defined PRIV_EFFECTIVE && defined PRIV_FILE_DAC_WRITE priv_set_t *pset = priv_allocset (); if (pset) @@ -47,13 +47,13 @@ can_write_any_file (void) && priv_ismember (pset, PRIV_FILE_DAC_WRITE)); priv_freeset (pset); } - else #else /* In traditional Unix, only root can unlink directories. */ can = (geteuid () == 0); #endif + can_write = can; initialized = true; } - return can; + return can_write; }