From 7dc0229aafe295bbbe1ebfea8061179f2b1f9297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Thu, 30 Oct 2008 17:50:45 +0100 Subject: [PATCH] (main): Fixed file locking. Rev: nettle/tools/sexp-conv.c:1.3 --- nettle/tools/sexp-conv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nettle/tools/sexp-conv.c b/nettle/tools/sexp-conv.c index e156877c..d6ebef03 100644 --- a/nettle/tools/sexp-conv.c +++ b/nettle/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