304038
From 31568ef6a91b0f441c64fe79f7fa94a32be4dc97 Mon Sep 17 00:00:00 2001
304038
From: Karel Zak <kzak@redhat.com>
304038
Date: Tue, 7 Oct 2014 12:12:39 +0200
304038
Subject: [PATCH 131/135] flock: zero timeout is valid
304038
304038
This patch reverts Sami's "timeout cannot be zero", introduced
304038
in commit 605325b23b36238c8f3ae165e37cab9064553cf7.
304038
304038
The --timeout 0 has been originally interpreted as --nonblock. The
304038
patch also add hint about this behavior to the man page.
304038
304038
Upstream: http://github.com/karelzak/util-linux/commit/c4604c38b503c8c46e50fc2048ebbcbcfcad3802
304038
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1455398
304038
Signed-off-by: Karel Zak <kzak@redhat.com>
304038
---
304038
 sys-utils/flock.1 | 4 +++-
304038
 sys-utils/flock.c | 2 --
304038
 2 files changed, 3 insertions(+), 3 deletions(-)
304038
304038
diff --git a/sys-utils/flock.1 b/sys-utils/flock.1
304038
index b28526f69..d5e85e082 100644
304038
--- a/sys-utils/flock.1
304038
+++ b/sys-utils/flock.1
304038
@@ -83,7 +83,9 @@ Fail if the lock cannot be acquired within
304038
 Decimal fractional values are allowed.
304038
 See the
304038
 .I \-E
304038
-option for the exit code used.
304038
+option for the exit code used. The zero number of
304038
+.IR seconds
304038
+is interpreted as \fB\-\-nonblock\fR.
304038
 .TP
304038
 \fB\-o\fP, \fB\-\-close\fP
304038
 Close the file descriptor on which the lock is held before executing
304038
diff --git a/sys-utils/flock.c b/sys-utils/flock.c
304038
index 18625a029..7dad46af0 100644
304038
--- a/sys-utils/flock.c
304038
+++ b/sys-utils/flock.c
304038
@@ -175,8 +175,6 @@ int main(int argc, char *argv[])
304038
 			have_timeout = 1;
304038
 			strtotimeval_or_err(optarg, &timeout.it_value,
304038
 				_("invalid timeout value"));
304038
-			if (timeout.it_value.tv_sec + timeout.it_value.tv_usec == 0)
304038
-				errx(EX_USAGE, _("timeout cannot be zero"));
304038
 			break;
304038
 		case 'E':
304038
 			conflict_exit_code = strtos32_or_err(optarg,
304038
-- 
304038
2.13.6
304038