Here we just fix the remote driver so that if the server goes down, the process doesn't die on SIGPIPE.
Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-domain-lookup-1/src/remote_internal.c libvirt-domain-lookup-2/src/remote_internal.c
--- libvirt-domain-lookup-1/src/remote_internal.c 2007-07-03 11:21:58.000000000 +0100
+++ libvirt-domain-lookup-2/src/remote_internal.c 2007-07-03 15:17:05.000000000 +0100
@@ -2503,7 +2503,16 @@
char *bytes, int len)
{
char *p;
- int err;
+ int err, ret = 0;
+ struct sigaction old_sa, new_sa;
+
+ /* Protect against SIGPIPE. */
+ memset (&new_sa, 0, sizeof new_sa);
+ new_sa.sa_handler = SIG_IGN;
+ if (sigaction (SIGPIPE, &new_sa, &old_sa) == -1) {
+ error (in_open ? NULL : conn, VIR_ERR_SYSTEM_ERROR, strerror (errno));
+ return -1;
+ }
p = bytes;
if (priv->uses_tls) {
@@ -2514,7 +2523,8 @@
continue;
error (in_open ? NULL : conn,
VIR_ERR_GNUTLS_ERROR, gnutls_strerror (err));
- return -1;
+ ret = -1;
+ goto restore_sa;
}
len -= err;
p += err;
@@ -2528,7 +2538,8 @@
continue;
error (in_open ? NULL : conn,
VIR_ERR_SYSTEM_ERROR, strerror (errno));
- return -1;
+ ret = -1;
+ goto restore_sa;
}
len -= err;
p += err;
@@ -2536,7 +2547,10 @@
while (len > 0);
}
- return 0;
+ restore_sa:
+ /* Restore SIGPIPE handler. */
+ sigaction (SIGPIPE, &old_sa, NULL);
+ return ret;
}
static int
smime.p7s
Description: S/MIME Cryptographic Signature
-- Libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
