about summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-02-26 12:09:20 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-02-26 12:09:20 +0000
commit07b6256d8ea03805dd8a24c184bf455ee31d6115 (patch)
tree98e16977e063db6d46c7b13e4b82c3cef3978dd9 /Src/Modules
parentecc7dc91f639a5849ba2983786d932007f7a0773 (diff)
downloadzsh-07b6256d8ea03805dd8a24c184bf455ee31d6115.tar.gz
zsh-07b6256d8ea03805dd8a24c184bf455ee31d6115.tar.xz
zsh-07b6256d8ea03805dd8a24c184bf455ee31d6115.zip
27756: add OS file locking to calendar
add errflag test to loop over fcntl()
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/system.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Src/Modules/system.c b/Src/Modules/system.c
index 93796128b..f6a21d160 100644
--- a/Src/Modules/system.c
+++ b/Src/Modules/system.c
@@ -463,6 +463,8 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
     if (timeout > 0) {
 	time_t end = time(NULL) + (time_t)timeout;
 	while (fcntl(flock_fd, F_SETLK, &lck) < 0) {
+	    if (errflag)
+		return 1;
 	    if (errno != EINTR && errno != EACCES && errno != EAGAIN) {
 		zwarnnam(nam, "failed to lock file %s: %e", args[0], errno);
 		return 1;
@@ -473,6 +475,8 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
 	}
     } else {
 	while (fcntl(flock_fd, F_SETLKW, &lck) < 0) {
+	    if (errflag)
+		return 1;
 	    if (errno == EINTR)
 		continue;
 	    zwarnnam(nam, "failed to lock file %s: %e", args[0], errno);