From: Timo Sirainen Date: Mon, 20 Oct 2003 01:50:18 +0000 (+0300) Subject: save errno in failures X-Git-Tag: 1.1.alpha1~4290 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83bce03e58f5febd7dc67d89480dd902304787e4;p=thirdparty%2Fdovecot%2Fcore.git save errno in failures --HG-- branch : HEAD --- diff --git a/src/lib/file-dotlock.c b/src/lib/file-dotlock.c index ad64c4520d..07441e3a28 100644 --- a/src/lib/file-dotlock.c +++ b/src/lib/file-dotlock.c @@ -298,9 +298,12 @@ static int dotlock_create(const char *path, const char *temp_prefix, now = time(NULL); } while (now < max_wait_time); - if (ret <= 0) { + if (ret <= 0 && lock_info.fd != -1) { + int old_errno = errno; + (void)close(lock_info.fd); lock_info.fd = -1; + errno = old_errno; } *fd = lock_info.fd;