aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-03-03 13:09:58 +0000
committerFrancois Pons <fpons@mandriva.com>2003-03-03 13:09:58 +0000
commit9accf4ef442661ca16d045919b4ae062bd34ecd9 (patch)
tree22002e364251f96ddeeea7ee0ec66d93818fd1f9 /URPM.xs
parent86f4e762e4f71a28e5e58bec7bf196810fda5d32 (diff)
downloadperl-URPM-9accf4ef442661ca16d045919b4ae062bd34ecd9.tar
perl-URPM-9accf4ef442661ca16d045919b4ae062bd34ecd9.tar.gz
perl-URPM-9accf4ef442661ca16d045919b4ae062bd34ecd9.tar.bz2
perl-URPM-9accf4ef442661ca16d045919b4ae062bd34ecd9.tar.xz
perl-URPM-9accf4ef442661ca16d045919b4ae062bd34ecd9.zip
0.81-11mdk
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs9
1 files changed, 5 insertions, 4 deletions
diff --git a/URPM.xs b/URPM.xs
index d1c6ffa..51a0c5d 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -738,9 +738,9 @@ static void *rpmRunTransactions_callback(const void *h,
const void * pkgKey,
void * data) {
static int last_amount;
- static FD_t fd = NULL;
static struct timeval tprev;
static struct timeval tcurr;
+ static FD_t fd = NULL;
long delta;
int i;
struct s_TransactionData *td = data;
@@ -812,11 +812,12 @@ static void *rpmRunTransactions_callback(const void *h,
PUTBACK;
i = call_sv(callback, callback == td->callback_open ? G_SCALAR : G_DISCARD);
SPAGAIN;
- if (i != 1 && callback == td->callback_open) croak("callback_open should return a file handle");
- if (i == 1) {
+ if (callback == td->callback_open) {
+ if (i != 1) croak("callback_open should return a file handle");
i = POPi;
fd = fdDup(i);
fd = fdLink(fd, "persist perl-URPM");
+ Fcntl(fd, F_SETFD, 1); /* necessary to avoid forked/execed process to lock removable */
PUTBACK;
} else if (callback == td->callback_close) {
fd = fdFree(fd, "persist perl-URPM");
@@ -829,7 +830,7 @@ static void *rpmRunTransactions_callback(const void *h,
LEAVE;
}
}
- return fd;
+ return callback == td->callback_open ? fd : NULL;
}
MODULE = URPM PACKAGE = URPM::Package PREFIX = Pkg_