r3585 - branches/2.0/varnish-cache/lib/libvarnish

tfheen at projects.linpro.no tfheen at projects.linpro.no
Thu Feb 5 10:12:16 CET 2009


Author: tfheen
Date: 2009-02-05 10:12:15 +0100 (Thu, 05 Feb 2009)
New Revision: 3585

Modified:
   branches/2.0/varnish-cache/lib/libvarnish/flopen.c
   branches/2.0/varnish-cache/lib/libvarnish/vpf.c
Log:
Merge r3335: Sync with FreeBSD



Modified: branches/2.0/varnish-cache/lib/libvarnish/flopen.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvarnish/flopen.c	2009-02-05 09:07:26 UTC (rev 3584)
+++ branches/2.0/varnish-cache/lib/libvarnish/flopen.c	2009-02-05 09:12:15 UTC (rev 3585)
@@ -26,17 +26,17 @@
  *
  * $Id$
  * Derived from:
- * $FreeBSD: src/lib/libutil/flopen.c,v 1.7 2007/05/23 12:09:33 des Exp $
+ * $FreeBSD: head/lib/libutil/flopen.c 184094 2008-10-20 18:11:30Z des $
  */
 
 #include "config.h"
 
-#include <sys/file.h>
 #include <sys/stat.h>
 
 #include <errno.h>
 #include <fcntl.h>
 #include <stdarg.h>
+#include <string.h>
 #include <unistd.h>
 
 #include "config.h"
@@ -46,8 +46,8 @@
 flopen(const char *path, int flags, ...)
 {
 	int fd, operation, serrno, trunc;
-	struct stat sb, fsb;
 	struct flock lock;
+	struct stat sb, fsb;
 	mode_t mode;
 
 #ifdef O_EXLOCK
@@ -63,10 +63,9 @@
 		va_end(ap);
 	}
 
+	memset(&lock, 0, sizeof lock);
 	lock.l_type = ((flags & O_ACCMODE) == O_RDONLY) ? F_RDLCK : F_WRLCK;
-	lock.l_start = 0;
 	lock.l_whence = SEEK_SET;
-	lock.l_len = 0;
 	operation = (flags & O_NONBLOCK) ? F_SETLK : F_SETLKW;
 
 	trunc = (flags & O_TRUNC);

Modified: branches/2.0/varnish-cache/lib/libvarnish/vpf.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvarnish/vpf.c	2009-02-05 09:07:26 UTC (rev 3584)
+++ branches/2.0/varnish-cache/lib/libvarnish/vpf.c	2009-02-05 09:12:15 UTC (rev 3585)
@@ -25,7 +25,7 @@
  *
  * $Id$
  * Derived from:
- * $FreeBSD: src/lib/libutil/pidfile.c,v 1.5 2007/05/11 11:10:05 des Exp $
+ * $FreeBSD: head/lib/libutil/pidfile.c 184091 2008-10-20 17:41:08Z des $
  */
 
 #include "config.h"
@@ -230,14 +230,8 @@
 static int
 _vpf_remove(struct pidfh *pfh, int freeit)
 {
-	struct flock lock;
 	int error;
 
-	lock.l_type = F_UNLCK;
-	lock.l_start = 0;
-	lock.l_whence = SEEK_SET;
-	lock.l_len = 0;
-
 	error = vpf_verify(pfh);
 	if (error != 0) {
 		errno = error;
@@ -246,10 +240,6 @@
 
 	if (unlink(pfh->pf_path) == -1)
 		error = errno;
-	if (fcntl(pfh->pf_fd, F_SETLK, &lock) == -1) {
-		if (error == 0)
-			error = errno;
-	}
 	if (close(pfh->pf_fd) == -1) {
 		if (error == 0)
 			error = errno;



More information about the varnish-commit mailing list