Bruno Haible <[EMAIL PROTECTED]> writes:
>> Perhaps it's the "else #else" which confused you? (It certainly confuses
>> me...)
>
> If it confuses even you, then it's late time to make this code more
> readable!
OK, thanks, I installed this. It's not exactly what you recommended, but
it should be good enough.
2007-03-30 Paul Eggert <[EMAIL PROTECTED]>
* lib/write-any-file.c (can_write_any_file): Fix else-else bug
reported by Bruno Haible.
--- lib/write-any-file.c 23 Mar 2007 17:33:07 -0000 1.1
+++ lib/write-any-file.c 30 Mar 2007 07:08:47 -0000
@@ -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;
}