1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-07 15:00:34 -08:00

* movemail.c (popmail): Report fchown failure instead of ignoring it.

But if the file already has the right ownership, don't worry about it.
This commit is contained in:
Paul Eggert 2011-02-21 14:31:55 -08:00
parent 4df52042a5
commit f0939c31a6
2 changed files with 15 additions and 1 deletions

View file

@ -723,7 +723,18 @@ popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse
error ("Error in open: %s, %s", strerror (errno), outfile);
return EXIT_FAILURE;
}
fchown (mbfi, getuid (), -1);
if (fchown (mbfi, getuid (), -1) != 0)
{
int fchown_errno = errno;
struct stat st;
if (fstat (mbfi, &st) != 0 || st.st_uid != getuid ())
{
pop_close (server);
error ("Error in fchown: %s, %s", strerror (fchown_errno), outfile);
return EXIT_FAILURE;
}
}
if ((mbf = fdopen (mbfi, "wb")) == NULL)
{