From: des Date: Mon, 20 Oct 2008 18:40:32 +0000 (+0000) Subject: Sync with FreeBSD X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68e467d939b1acc087ff74e370e91706180128d6;p=varnish Sync with FreeBSD git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3335 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/lib/libvarnish/flopen.c b/varnish-cache/lib/libvarnish/flopen.c index ab873937..fe552f98 100644 --- a/varnish-cache/lib/libvarnish/flopen.c +++ b/varnish-cache/lib/libvarnish/flopen.c @@ -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 #include #include #include #include +#include #include #include "config.h" @@ -46,8 +46,8 @@ int 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 @@ flopen(const char *path, int flags, ...) 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); diff --git a/varnish-cache/lib/libvarnish/vpf.c b/varnish-cache/lib/libvarnish/vpf.c index 1c1cf76f..69543a9c 100644 --- a/varnish-cache/lib/libvarnish/vpf.c +++ b/varnish-cache/lib/libvarnish/vpf.c @@ -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 @@ vpf_close(struct pidfh *pfh) 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 @@ _vpf_remove(struct pidfh *pfh, int freeit) 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;