cdown / rpms / util-linux

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