From 0866f38d3e50f6b3d963788120e1bc2f46fbe0a4 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 23 Aug 2005 12:15:59 +0000 Subject: correctly handle -1 fileno returned by callback_open --- URPM.xs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/URPM.xs b/URPM.xs index 312e96d..6762c08 100644 --- a/URPM.xs +++ b/URPM.xs @@ -1345,8 +1345,10 @@ static void *rpmRunTransactions_callback(const void *h, 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, (void *)1); /* necessary to avoid forked/execed process to lock removable */ + if (fd) { + fd = fdLink(fd, "persist perl-URPM"); + Fcntl(fd, F_SETFD, (void *)1); /* necessary to avoid forked/execed process to lock removable */ + } PUTBACK; } else if (callback == td->callback_close) { fd = fdFree(fd, "persist perl-URPM"); -- cgit v1.2.1