From: Niels Möller Date: Thu, 30 Oct 2008 16:50:45 +0000 (+0100) Subject: (main): Fixed file locking. X-Git-Tag: nettle_2.0_release_20090608~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1dc3733b8453f0d2eac386c7c056efa5e16917d0;p=thirdparty%2Fnettle.git (main): Fixed file locking. Rev: nettle/tools/sexp-conv.c:1.3 --- diff --git a/tools/sexp-conv.c b/tools/sexp-conv.c index e156877c..d6ebef03 100644 --- a/tools/sexp-conv.c +++ b/tools/sexp-conv.c @@ -380,8 +380,13 @@ main(int argc, char **argv) struct flock fl; memset(&fl, 0, sizeof(fl)); + fl.l_type = F_WRLCK; + fl.l_whence = SEEK_SET; + fl.l_start = 0; + fl.l_len = 0; /* Means entire file. */ + if (fcntl(STDOUT_FILENO, F_SETLKW, &fl) == -1) - die("Locking output file failed: $s\n", strerror(errno)); + die("Locking output file failed: %s\n", strerror(errno)); } #endif /* HAVE_FCNTL_LOCKING */ if (options.hash)