From 1dc3733b8453f0d2eac386c7c056efa5e16917d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Thu, 30 Oct 2008 17:50:45 +0100 Subject: [PATCH] (main): Fixed file locking. Rev: nettle/tools/sexp-conv.c:1.3 --- tools/sexp-conv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) -- GitLab