From 07784ae4244d8b09651185f26699c213ac693b8d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 30 Mar 2007 07:08:51 +0000 Subject: [PATCH] * lib/write-any-file.c (can_write_any_file): Fix else-else bug reported by Bruno Haible. --- ChangeLog | 5 +++++ lib/write-any-file.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48372b626..eb1838a75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-30 Paul Eggert + + * lib/write-any-file.c (can_write_any_file): Fix else-else bug + reported by Bruno Haible. + 2007-03-29 Bruno Haible * m4/iconv.m4 (AM_ICONV_LINK): Require AC_CANONICAL_HOST. Test against diff --git a/lib/write-any-file.c b/lib/write-any-file.c index d0161777c..19ab99efd 100644 --- a/lib/write-any-file.c +++ b/lib/write-any-file.c @@ -34,10 +34,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 +48,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; } -- 2.11.0