]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
save errno in failures
authorTimo Sirainen <tss@iki.fi>
Mon, 20 Oct 2003 01:50:18 +0000 (04:50 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 20 Oct 2003 01:50:18 +0000 (04:50 +0300)
--HG--
branch : HEAD

src/lib/file-dotlock.c

index ad64c4520d4f1e382f601710e38a7d238bd0f396..07441e3a28cbe6d62c5abafc0fd396db68d9b721 100644 (file)
@@ -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;