summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHallvard B Furuseth <h.b.furuseth@usit.uio.no>1997-09-05 00:00:00 +0000
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-09-05 00:00:00 +1200
commit08b714dde408c78ef493825678e6902b5f19f3b0 (patch)
tree2854f0b3e0658748afe485374eae6ab93cfc4805
parent08ea043f90d6fea4e1b9bc32f82e31d999c4b3d1 (diff)
downloadperl-08b714dde408c78ef493825678e6902b5f19f3b0.tar.gz
Further fix to lseek's in lockf_emulate_flock
private-msgid: 199708102225.AAA16970@bombur2.uio.no
-rw-r--r--pp_sys.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pp_sys.c b/pp_sys.c
index d9524032c2..d0915e0327 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);
}