From: Hallvard B Furuseth Date: Fri, 5 Sep 1997 00:00:00 +0000 (+0000) Subject: Further fix to lseek's in lockf_emulate_flock X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=08b714dde408c78ef493825678e6902b5f19f3b0;p=p5sagit%2Fp5-mst-13.2.git Further fix to lseek's in lockf_emulate_flock private-msgid: 199708102225.AAA16970@bombur2.uio.no --- diff --git a/pp_sys.c b/pp_sys.c index d952403..d0915e0 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -4381,7 +4381,8 @@ int operation; save_errno = errno; pos = lseek(fd, (Off_t)0, SEEK_CUR); /* get pos to restore later */ if (pos > 0) /* is seekable and needs to be repositioned */ - lseek(fd, (Off_t)0, SEEK_SET); + if (lseek(fd, (Off_t)0, SEEK_SET) < 0) + pos = -1; /* seek failed, so don't seek back afterwards */ errno = save_errno; switch (operation) { @@ -4417,8 +4418,7 @@ int operation; } if (pos > 0) /* need to restore position of the handle */ - if (lseek(fd, pos, SEEK_SET) == -1) - i = -1; + lseek(fd, pos, SEEK_SET); /* ignore error here */ return (i); }