summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShantanu Goel <sgoel@trade4.test-jc.tower-research.com>2012-06-18 09:26:45 -0400
committerStephen Gallagher <sgallagh@redhat.com>2012-06-18 14:39:07 -0400
commitfa8ddadd3396136f4f37da1b60c49c7f8c5065e1 (patch)
tree0dbeb1b317a3fbc10d8d99809d76a14da2cebda0 /src
parent0664e450bd30db4c316f514ae79a2eef94d85c61 (diff)
downloadsssd-fa8ddadd3396136f4f37da1b60c49c7f8c5065e1.tar.gz
sssd-fa8ddadd3396136f4f37da1b60c49c7f8c5065e1.tar.xz
sssd-fa8ddadd3396136f4f37da1b60c49c7f8c5065e1.zip
Do not send SIGPIPE on disconnection
Note we set MSG_NOSIGNAL to avoid having to fiddle with signal masks but also do not want to die in case SIGPIPE gets raised and the application does not handle it.
Diffstat (limited to 'src')
-rw-r--r--src/sss_client/common.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/sss_client/common.c b/src/sss_client/common.c
index 6645112c8..e47ac6e48 100644
--- a/src/sss_client/common.c
+++ b/src/sss_client/common.c
@@ -50,6 +50,19 @@
#include <pthread.h>
#endif
+/*
+* Note we set MSG_NOSIGNAL to avoid
+* having to fiddle with signal masks
+* but also do not want to die in case
+* SIGPIPE gets raised and the application
+* does not handle it.
+*/
+#ifdef MSG_NOSIGNAL
+#define SSS_DEFAULT_WRITE_FLAGS MSG_NOSIGNAL
+#else
+#define SSS_DEFAULT_WRITE_FLAGS 0
+#endif
+
/* common functions */
int sss_cli_sd = -1; /* the sss client socket descriptor */
@@ -134,14 +147,16 @@ static enum sss_status sss_cli_send_req(enum sss_cli_command cmd,
errno = 0;
if (datasent < SSS_NSS_HEADER_SIZE) {
- res = write(sss_cli_sd,
- (char *)header + datasent,
- SSS_NSS_HEADER_SIZE - datasent);
+ res = send(sss_cli_sd,
+ (char *)header + datasent,
+ SSS_NSS_HEADER_SIZE - datasent,
+ SSS_DEFAULT_WRITE_FLAGS);
} else {
rdsent = datasent - SSS_NSS_HEADER_SIZE;
- res = write(sss_cli_sd,
- (const char *)rd->data + rdsent,
- rd->len - rdsent);
+ res = send(sss_cli_sd,
+ (const char *)rd->data + rdsent,
+ rd->len - rdsent,
+ SSS_DEFAULT_WRITE_FLAGS);
}
error = errno;