dcavalca / rpms / util-linux

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