From 07b6256d8ea03805dd8a24c184bf455ee31d6115 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 26 Feb 2010 12:09:20 +0000 Subject: 27756: add OS file locking to calendar add errflag test to loop over fcntl() --- Src/Modules/system.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Src') 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); -- cgit 1.4.1