r3335 - trunk/varnish-cache/lib/libvarnish
des at projects.linpro.no
des at projects.linpro.no
Mon Oct 20 20:40:32 CEST 2008
Author: des
Date: 2008-10-20 20:40:32 +0200 (Mon, 20 Oct 2008)
New Revision: 3335
Modified:
trunk/varnish-cache/lib/libvarnish/flopen.c
trunk/varnish-cache/lib/libvarnish/vpf.c
Log:
Sync with FreeBSD
Modified: trunk/varnish-cache/lib/libvarnish/flopen.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/flopen.c 2008-10-20 18:33:15 UTC (rev 3334)
+++ trunk/varnish-cache/lib/libvarnish/flopen.c 2008-10-20 18:40:32 UTC (rev 3335)
@@ -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: trunk/varnish-cache/lib/libvarnish/vpf.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/vpf.c 2008-10-20 18:33:15 UTC (rev 3334)
+++ trunk/varnish-cache/lib/libvarnish/vpf.c 2008-10-20 18:40:32 UTC (rev 3335)
@@ -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