aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-06-30 04:58:54 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-06-30 04:58:54 +0000
commitd927d69f118d3e1e56e67e47e9e4ec97bce2f016 (patch)
tree3609db9e3ae162a4f44f425d27ceefd140b7e990
parentea819fd3be07f4868a456932162fd1713cfdb3a2 (diff)
downloadperl-URPM-d927d69f118d3e1e56e67e47e9e4ec97bce2f016.tar
perl-URPM-d927d69f118d3e1e56e67e47e9e4ec97bce2f016.tar.gz
perl-URPM-d927d69f118d3e1e56e67e47e9e4ec97bce2f016.tar.bz2
perl-URPM-d927d69f118d3e1e56e67e47e9e4ec97bce2f016.tar.xz
perl-URPM-d927d69f118d3e1e56e67e47e9e4ec97bce2f016.zip
Add function rpmErrorWriteTo($fd)
-rw-r--r--URPM.pm2
-rw-r--r--URPM.xs14
2 files changed, 16 insertions, 0 deletions
diff --git a/URPM.pm b/URPM.pm
index 77774c8..13ebbbf 100644
--- a/URPM.pm
+++ b/URPM.pm
@@ -645,6 +645,8 @@ Sets rpm verbosity level. $level is an integer between 2 (RPMMESS_CRIT) and 7
=item rpmErrorString()
+=item rpmErrorWriteTo($fd)
+
=back
=head1 COPYRIGHT
diff --git a/URPM.xs b/URPM.xs
index e1fefb9..d125cd4 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -239,6 +239,13 @@ struct _FD_s {
};
/*@access FD_t@*/
+static int rpmError_callback_data;
+void rpmError_callback() {
+ if (rpmErrorCode() != RPMERR_UNLINK && rpmErrorCode() != RPMERR_RMDIR) {
+ write(rpmError_callback_data, rpmErrorString(), strlen(rpmErrorString()));
+ }
+}
+
static inline
void fdInitDigest(FD_t fd, pgpHashAlgo hashalgo, int flags)
/*@modifies fd @*/
@@ -3643,4 +3650,11 @@ setVerbosity(level)
const char *
rpmErrorString()
+void
+rpmErrorWriteTo(fd)
+ int fd
+ CODE:
+ rpmError_callback_data = fd;
+ rpmErrorSetCallback(rpmError_callback);
+
/* vim:set ts=8 sts=2 sw=2: */