aboutsummaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
Diffstat (limited to 'nscd')
-rw-r--r--nscd/nscd.c1
-rw-r--r--nscd/nscd_getgr_r.c4
-rw-r--r--nscd/nscd_getpw_r.c22
3 files changed, 14 insertions, 13 deletions
diff --git a/nscd/nscd.c b/nscd/nscd.c
index a53abc1fe0..83a7b5be86 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -117,6 +117,7 @@ main (int argc, char **argv)
signal (SIGINT, termination_handler);
signal (SIGQUIT, termination_handler);
signal (SIGTERM, termination_handler);
+ signal (SIGPIPE, SIG_IGN);
/* Check if we are already running. */
if (check_pid (_PATH_NSCDPID))
diff --git a/nscd/nscd_getgr_r.c b/nscd/nscd_getgr_r.c
index 71acc0608a..7db28c215e 100644
--- a/nscd/nscd_getgr_r.c
+++ b/nscd/nscd_getgr_r.c
@@ -71,7 +71,7 @@ nscd_open_socket (void)
int sock;
int saved_errno = errno;
- sock = socket (PF_UNIX, SOCK_STREAM, 0);
+ sock = __socket (PF_UNIX, SOCK_STREAM, 0);
if (sock < 0)
{
__set_errno (saved_errno);
@@ -80,7 +80,7 @@ nscd_open_socket (void)
addr.sun_family = AF_UNIX;
strcpy (addr.sun_path, _PATH_NSCDSOCKET);
- if (connect (sock, (struct sockaddr *) &addr, sizeof (addr)) < 0)
+ if (__connect (sock, (struct sockaddr *) &addr, sizeof (addr)) < 0)
{
close (sock);
__set_errno (saved_errno);
diff --git a/nscd/nscd_getpw_r.c b/nscd/nscd_getpw_r.c
index 4804a4578a..fd512ab1b5 100644
--- a/nscd/nscd_getpw_r.c
+++ b/nscd/nscd_getpw_r.c
@@ -71,7 +71,7 @@ nscd_open_socket (void)
int sock;
int saved_errno = errno;
- sock = socket (PF_UNIX, SOCK_STREAM, 0);
+ sock = __socket (PF_UNIX, SOCK_STREAM, 0);
if (sock < 0)
{
__set_errno (saved_errno);
@@ -80,7 +80,7 @@ nscd_open_socket (void)
addr.sun_family = AF_UNIX;
strcpy (addr.sun_path, _PATH_NSCDSOCKET);
- if (connect (sock, (struct sockaddr *) &addr, sizeof (addr)) < 0)
+ if (__connect (sock, (struct sockaddr *) &addr, sizeof (addr)) < 0)
{
close (sock);
__set_errno (saved_errno);
@@ -142,9 +142,9 @@ __nscd_getpw_r (const char *key, request_type type, struct passwd *resultbuf,
struct iovec vec[5];
char *p = buffer;
- if (buflen < pw_resp.pw_name_len + 1 + pw_resp.pw_passwd_len + 1
- + pw_resp.pw_gecos_len + 1 + pw_resp.pw_dir_len + 1
- + pw_resp.pw_shell_len + 1)
+ if (buflen < (pw_resp.pw_name_len + 1 + pw_resp.pw_passwd_len + 1
+ + pw_resp.pw_gecos_len + 1 + pw_resp.pw_dir_len + 1
+ + pw_resp.pw_shell_len + 1))
{
__set_errno (ERANGE);
close (sock);
@@ -173,14 +173,14 @@ __nscd_getpw_r (const char *key, request_type type, struct passwd *resultbuf,
buflen -= (pw_resp.pw_dir_len + 1);
/* get pw_pshell */
vec[4].iov_base = p;
- vec[4].iov_len = pw_resp.pw_dir_len;
- p += pw_resp.pw_dir_len + 1;
- buflen -= (pw_resp.pw_dir_len + 1);
+ vec[4].iov_len = pw_resp.pw_shell_len;
+ p += pw_resp.pw_shell_len + 1;
+ buflen -= (pw_resp.pw_shell_len + 1);
nbytes = readv (sock, vec, 5);
- if (nbytes != pw_resp.pw_name_len + 1 + pw_resp.pw_passwd_len + 1 +
- pw_resp.pw_gecos_len + 1 + pw_resp.pw_dir_len + 1 +
- pw_resp.pw_shell_len + 1)
+ if (nbytes != (pw_resp.pw_name_len + pw_resp.pw_passwd_len
+ + pw_resp.pw_gecos_len + pw_resp.pw_dir_len
+ + pw_resp.pw_shell_len))
{
close (sock);
return 1;