[dovecot-cvs] dovecot/src/lib file-dotlock.c, 1.15, 1.16 file-dotlock.h, 1.6, 1.7

cras at procontrol.fi cras at procontrol.fi
Mon Jun 28 19:44:41 EEST 2004


Update of /home/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv30848

Modified Files:
	file-dotlock.c file-dotlock.h 
Log Message:
don't close dotlock fd if it's given as -1



Index: file-dotlock.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/file-dotlock.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- file-dotlock.c	20 Jun 2004 11:46:10 -0000	1.15
+++ file-dotlock.c	28 Jun 2004 16:44:38 -0000	1.16
@@ -487,9 +487,11 @@
 			return -1;
 		}
 	}
-	if (close(fd) < 0) {
-		i_error("close(%s) failed: %m", lock_path);
-		return -1;
+	if (fd != -1) {
+		if (close(fd) < 0) {
+			i_error("close(%s) failed: %m", lock_path);
+			return -1;
+		}
 	}
 
 	if (verify_owner) {

Index: file-dotlock.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/file-dotlock.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- file-dotlock.h	3 May 2004 22:08:26 -0000	1.6
+++ file-dotlock.h	28 Jun 2004 16:44:38 -0000	1.7
@@ -47,8 +47,9 @@
 		      int (*callback)(unsigned int secs_left, int stale,
 				      void *context),
 		      void *context);
-/* Replaces path with path.lock file. Closes given fd. If verify_owner is TRUE,
-   it checks that lock file hasn't been overwritten before renaming. */
+/* Replaces path with path.lock file. If verify_owner is TRUE, it checks that
+   lock file hasn't been overwritten before renaming. Closes given fd, unless
+   it's given as -1 in which case verify_owner must be FALSE. */
 int file_dotlock_replace(const char *path, const char *lock_suffix,
 			 int fd, int verify_owner);
 /* Like file_unlock_dotlock(). Closes given fd. */



More information about the dovecot-cvs mailing list