X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/b0fa97c1588ce368d0fd490472d2a7f552c45dbf..f5730918ef684baafbd9e606a1d4eb06914563cc:/src/src/exim_lock.c diff --git a/src/src/exim_lock.c b/src/src/exim_lock.c index 074a951d1..363c1bc71 100644 --- a/src/src/exim_lock.c +++ b/src/src/exim_lock.c @@ -10,7 +10,8 @@ Default is -fcntl -lockfile. Argument: the name of the lock file -Copyright (c) The Exim Maintainers 2016 +Copyright (c) The Exim Maintainers 2016 - 2021 +SPDX-License-Identifier: GPL-2.0-or-later */ #include "os.h" @@ -87,7 +88,6 @@ the other stuff in os.c, so force the other macros to omit it. */ static void sigalrm_handler(int sig) { -sig = sig; /* Keep picky compilers happy */ sigalrm_seen = TRUE; } @@ -584,16 +584,28 @@ else if (restore_times) { struct stat strestore; -#ifdef EXIM_HAVE_OPENAT +#ifdef EXIM_HAVE_FUTIMENS int fd = open(filename, O_RDWR); /* use fd for both get & restore */ struct timespec tt[2]; - fstat(fd, &strestore); + if (fd < 0) + { + printf("open '%s': %s\n", filename, strerror(errno)); + yield = 1; + goto CLEAN_UP; + } + if (fstat(fd, &strestore) != 0) + { + printf("fstat '%s': %s\n", filename, strerror(errno)); + yield = 1; + close(fd); + goto CLEAN_UP; + } i = system(command); tt[0] = strestore.st_atim; tt[1] = strestore.st_mtim; - futimens(fd, tt); - close(fd); + (void) futimens(fd, tt); + (void) close(fd); #else struct utimbuf ut;