From 2ad671969e26dc1d2650c6af25ec44d53ff223ee Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 3 Jul 2012 11:40:06 +0200 Subject: Locking fussiness --- src/indexamajig.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/indexamajig.c') diff --git a/src/indexamajig.c b/src/indexamajig.c index fe4960fc..1981908e 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -283,7 +283,7 @@ static void process_image(const struct index_args *iargs, char *outfilename = iargs->outfile; int fd; FILE *fh; - struct flock fl = {F_WRLCK, SEEK_SET, 0, 0, 0}; + struct flock fl; image.features = NULL; image.data = NULL; @@ -409,7 +409,10 @@ static void process_image(const struct index_args *iargs, } /* Write Lock */ - fl.l_pid = getpid(); + fl.l_type = F_WRLCK; + fl.l_whence = SEEK_SET; + fl.l_start = 0; + fl.l_len = 0; /* Means "lock the whole file" */ fd = open(outfile, O_WRONLY); if ( fd == -1 ) { -- cgit v1.2.3