diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2011-02-21 14:31:55 -0800 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-02-21 14:31:55 -0800 |
| commit | f0939c31a6f4f7afec3adf3f31817f998af6e667 (patch) | |
| tree | c02c6733800f65c5c648ae3e9d35427ee4d87509 /lib-src/movemail.c | |
| parent | 4df52042a5a9489d8974d7c1d0c7b862a7ca1703 (diff) | |
| download | emacs-f0939c31a6f4f7afec3adf3f31817f998af6e667.tar.gz | |
* movemail.c (popmail): Report fchown failure instead of ignoring it.
But if the file already has the right ownership, don't worry about it.
Diffstat (limited to 'lib-src/movemail.c')
| -rw-r--r-- | lib-src/movemail.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib-src/movemail.c b/lib-src/movemail.c index a5084f27f22..bc7fa8824e2 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -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) { |
