--- dovecot-1.2.2/src/lib/file-dotlock.c.org	2009-07-29 10:44:21.000000000 +0200
+++ dovecot-1.2.2/src/lib/file-dotlock.c	2009-07-29 10:44:42.000000000 +0200
@@ -780,7 +780,7 @@
 	fd = file_dotlock_open(set, path, flags, &dotlock);
 	umask(old_mask);
 
-	if (fd != -1 && (uid != (uid)-1 || gid != (gid_t)-1)) {
+	if (fd != -1 && (uid != (uid_t)-1 || gid != (gid_t)-1)) {
 		if (fchown(fd, uid, gid) < 0) {
 			if (errno == EPERM && uid == (uid_t)-1) {
 				i_error("%s", eperm_error_get_chgrp("fchown",
