dovecot: Log an error if fchown() fails, but not because of EPERM.

dovecot at dovecot.org dovecot at dovecot.org
Sun Oct 28 21:29:23 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/947a8a032371
changeset: 6653:947a8a032371
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Oct 28 21:29:19 2007 +0200
description:
Log an error if fchown() fails, but not because of EPERM.

diffstat:

1 file changed, 2 insertions(+), 1 deletion(-)
src/lib/file-copy.c |    3 ++-

diffs (13 lines):

diff -r c62f30cc1153 -r 947a8a032371 src/lib/file-copy.c
--- a/src/lib/file-copy.c	Sun Oct 28 21:26:26 2007 +0200
+++ b/src/lib/file-copy.c	Sun Oct 28 21:29:19 2007 +0200
@@ -66,7 +66,8 @@ static int file_copy_to_tmp(const char *
 	}
 
 	/* try to change the group, don't really care if it fails */
-	(void)fchown(fd_out, (uid_t)-1, st.st_gid);
+	if (fchown(fd_out, (uid_t)-1, st.st_gid) < 0 && errno != EPERM)
+		i_error("fchown(%s) failed: %m", tmppath);
 
 	input = i_stream_create_fd(fd_in, 0, FALSE);
 	output = o_stream_create_fd_file(fd_out, 0, FALSE);


More information about the dovecot-cvs mailing list