summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-08 10:19:27 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-08 10:19:27 +0000
commit93af7a870f71dbbb13443b4087703de0221add17 (patch)
treee767c53d4d4f1783640e5410f94655e45b58b3d0 /pp_sys.c
parentc116a00cf797ec2e6795338ee18b88d975e760c5 (diff)
parent2269e8ecc334a5a77bdb915666547431c0171402 (diff)
downloadperl-93af7a870f71dbbb13443b4087703de0221add17.tar.gz
Merge maint-5.004 branch (5.004_03) with mainline.
MANIFEST is out of sync. p4raw-id: //depot/perl@114
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 7cded5061f..78f7af561a 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -536,7 +536,7 @@ PP(pp_tie)
ENTER;
SAVEOP();
op = (OP *) &myop;
- if (perldb && curstash != debstash)
+ if (PERLDB_SUB && curstash != debstash)
op->op_private |= OPpENTERSUB_DB;
XPUSHs((SV*)GvCV(gv));
@@ -647,7 +647,7 @@ PP(pp_dbmopen)
ENTER;
SAVEOP();
op = (OP *) &myop;
- if (perldb && curstash != debstash)
+ if (PERLDB_SUB && curstash != debstash)
op->op_private |= OPpENTERSUB_DB;
PUTBACK;
pp_pushmark(ARGS);
@@ -4377,6 +4377,17 @@ int fd;
int operation;
{
int i;
+ int save_errno;
+ Off_t pos;
+
+ /* flock locks entire file so for lockf we need to do the same */
+ 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 */
+ if (lseek(fd, (Off_t)0, SEEK_SET) < 0)
+ pos = -1; /* seek failed, so don't seek back afterwards */
+ errno = save_errno;
+
switch (operation) {
/* LOCK_SH - get a shared lock */
@@ -4408,6 +4419,10 @@ int operation;
errno = EINVAL;
break;
}
+
+ if (pos > 0) /* need to restore position of the handle */
+ lseek(fd, pos, SEEK_SET); /* ignore error here */
+
return (i);
}