changeset 7213:45bfc162a43c HEAD

If fcntl() or flock() fails, log the lock_type.
author Timo Sirainen <tss@iki.fi>
date Mon, 04 Feb 2008 19:12:46 +0200
parents 2ed72512334b
children 2d58b1c2dfd0
files src/lib/file-lock.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/file-lock.c	Mon Feb 04 18:53:34 2008 +0200
+++ b/src/lib/file-lock.c	Mon Feb 04 19:12:46 2008 +0200
@@ -64,7 +64,10 @@
 			errno = EAGAIN;
 			return 0;
 		}
-		i_error("fcntl() locking failed for file %s: %m", path);
+		i_error("fcntl(%s) locking failed for file %s: %m",
+			lock_type == F_UNLCK ? "unlock" :
+			lock_type == F_RDLCK ? "read-lock" : "write-lock",
+			path);
 		return -1;
 #endif
 	}
@@ -97,7 +100,10 @@
 			   b) timeouted */
 			return 0;
 		}
-		i_error("flock() locking failed for file %s: %m", path);
+		i_error("flock(%s) locking failed for file %s: %m",
+			lock_type == F_UNLCK ? "unlock" :
+			lock_type == F_RDLCK ? "read-lock" : "write-lock",
+			path);
 		return -1;
 #endif
 	}