diff options
| author | Paul Eggert | 2011-02-21 14:31:55 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-02-21 14:31:55 -0800 |
| commit | f0939c31a6f4f7afec3adf3f31817f998af6e667 (patch) | |
| tree | c02c6733800f65c5c648ae3e9d35427ee4d87509 /lib-src | |
| parent | 4df52042a5a9489d8974d7c1d0c7b862a7ca1703 (diff) | |
| download | emacs-f0939c31a6f4f7afec3adf3f31817f998af6e667.tar.gz emacs-f0939c31a6f4f7afec3adf3f31817f998af6e667.zip | |
* 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')
| -rw-r--r-- | lib-src/ChangeLog | 3 | ||||
| -rw-r--r-- | lib-src/movemail.c | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index d865754cb40..e0a175e8167 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2011-02-21 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-02-21 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * movemail.c (popmail): Report fchown failure instead of ignoring it. | ||
| 4 | But if the file already has the right ownership, don't worry about it. | ||
| 5 | |||
| 3 | * make-docfile.c (input_buffer): Rename variables to avoid shadowing. | 6 | * make-docfile.c (input_buffer): Rename variables to avoid shadowing. |
| 4 | 7 | ||
| 5 | * movemail.c (main, pop_retr): Rename locals to avoid shadowing. | 8 | * movemail.c (main, pop_retr): Rename locals to avoid shadowing. |
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 | |||
| 723 | error ("Error in open: %s, %s", strerror (errno), outfile); | 723 | error ("Error in open: %s, %s", strerror (errno), outfile); |
| 724 | return EXIT_FAILURE; | 724 | return EXIT_FAILURE; |
| 725 | } | 725 | } |
| 726 | fchown (mbfi, getuid (), -1); | 726 | |
| 727 | if (fchown (mbfi, getuid (), -1) != 0) | ||
| 728 | { | ||
| 729 | int fchown_errno = errno; | ||
| 730 | struct stat st; | ||
| 731 | if (fstat (mbfi, &st) != 0 || st.st_uid != getuid ()) | ||
| 732 | { | ||
| 733 | pop_close (server); | ||
| 734 | error ("Error in fchown: %s, %s", strerror (fchown_errno), outfile); | ||
| 735 | return EXIT_FAILURE; | ||
| 736 | } | ||
| 737 | } | ||
| 727 | 738 | ||
| 728 | if ((mbf = fdopen (mbfi, "wb")) == NULL) | 739 | if ((mbf = fdopen (mbfi, "wb")) == NULL) |
| 729 | { | 740 | { |