summaryrefslogtreecommitdiffstats
path: root/proxy
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-04-03 16:31:14 -0400
committerSimo Sorce <simo@redhat.com>2013-04-03 16:39:11 -0400
commit212d8f424125cdd40c154b2f09a219d4d0325b8d (patch)
treeb46cb33dc9ff630eb75d212b4c03fc2315d24c85 /proxy
parentca7a49fbefef59fe4839a83077a3abaa995c47d9 (diff)
downloadgss-proxy-212d8f424125cdd40c154b2f09a219d4d0325b8d.tar.gz
gss-proxy-212d8f424125cdd40c154b2f09a219d4d0325b8d.tar.xz
gss-proxy-212d8f424125cdd40c154b2f09a219d4d0325b8d.zip
Use send() in client library to avoid SIGPIPE
The client library lives in applications that may not be blocking or ignoring SIGPIPE. Using write() can cause SIGPIPE to be raised in the application if the proxy is restarted. If the application does not catch the signal then it is terminated. Make sure this does not happen by using send() with the MSG_NOSIGNAL flag. Signed-off-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'proxy')
-rw-r--r--proxy/src/client/gpm_common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/proxy/src/client/gpm_common.c b/proxy/src/client/gpm_common.c
index 80f487c..d9015f6 100644
--- a/proxy/src/client/gpm_common.c
+++ b/proxy/src/client/gpm_common.c
@@ -177,7 +177,7 @@ static int gpm_send_buffer(struct gpm_ctx *gpmctx,
do {
ret = 0;
do {
- wn = write(gpmctx->fd, &size, sizeof(uint32_t));
+ wn = send(gpmctx->fd, &size, sizeof(uint32_t), MSG_NOSIGNAL);
if (wn == -1) {
ret = errno;
}
@@ -201,7 +201,7 @@ static int gpm_send_buffer(struct gpm_ctx *gpmctx,
pos = 0;
while (length > pos) {
- wn = write(gpmctx->fd, buffer + pos, length - pos);
+ wn = send(gpmctx->fd, buffer + pos, length - pos, MSG_NOSIGNAL);
if (wn == -1) {
if (errno == EINTR) {
continue;