diff options
Diffstat (limited to 'lockfile.c')
-rw-r--r-- | lockfile.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lockfile.c b/lockfile.c index 9268cdf325..f7e8104449 100644 --- a/lockfile.c +++ b/lockfile.c @@ -174,8 +174,15 @@ int hold_lock_file_for_update_timeout(struct lock_file *lk, const char *path, int flags, long timeout_ms) { int fd = lock_file_timeout(lk, path, flags, timeout_ms); - if (fd < 0 && (flags & LOCK_DIE_ON_ERROR)) - unable_to_lock_die(path, errno); + if (fd < 0) { + if (flags & LOCK_DIE_ON_ERROR) + unable_to_lock_die(path, errno); + else if (!(flags & LOCK_SILENT_ON_ERROR)) { + struct strbuf buf = STRBUF_INIT; + unable_to_lock_message(path, errno, &buf); + error("%s", buf.buf); + } + } return fd; } |