aboutsummaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
Diffstat (limited to 'nscd')
-rw-r--r--nscd/connections.c2
-rw-r--r--nscd/nscd-client.h5
-rw-r--r--nscd/nscd.c2
-rw-r--r--nscd/nscd_getgr_r.c30
-rw-r--r--nscd/nscd_gethst_r.c6
-rw-r--r--nscd/nscd_getpw_r.c28
6 files changed, 11 insertions, 62 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index dd0b230..2e87269 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -296,7 +296,7 @@ cannot handle old request version %d; current version is %d"),
/* No, sent the prepared record. */
if (TEMP_FAILURE_RETRY (write (fd, db->disabled_iov->iov_base,
db->disabled_iov->iov_len))
- != db->disabled_iov->iov_len
+ != (ssize_t) db->disabled_iov->iov_len
&& __builtin_expect (debug_level, 0) > 0)
{
/* We have problems sending the result. */
diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h
index 8e00df5..be3bc2f 100644
--- a/nscd/nscd-client.h
+++ b/nscd/nscd-client.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
@@ -110,4 +110,7 @@ typedef struct
} hst_response_header;
+/* Open socket connection to nscd server. */
+extern int __nscd_open_socket (void) attribute_hidden;
+
#endif /* nscd.h */
diff --git a/nscd/nscd.c b/nscd/nscd.c
index 97400d1..5844b38 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -176,7 +176,7 @@ main (int argc, char **argv)
while ((dirent = readdir64 (d)) != NULL)
{
char *endp;
- unsigned long int fdn = strtoul (dirent->d_name, &endp, 10);
+ long int fdn = strtol (dirent->d_name, &endp, 10);
if (*endp == '\0' && fdn != dfdn && fdn >= min_close_fd)
close ((int) fdn);
diff --git a/nscd/nscd_getgr_r.c b/nscd/nscd_getgr_r.c
index 1769ff1..eae2544 100644
--- a/nscd/nscd_getgr_r.c
+++ b/nscd/nscd_getgr_r.c
@@ -60,40 +60,12 @@ __nscd_getgrgid_r (gid_t gid, struct group *resultbuf, char *buffer,
}
-/* Create a socket connected to a name. */
-static int
-open_socket (void)
-{
- struct sockaddr_un addr;
- int sock;
- int saved_errno = errno;
-
- sock = __socket (PF_UNIX, SOCK_STREAM, 0);
- if (sock < 0)
- {
- __set_errno (saved_errno);
- return -1;
- }
-
- addr.sun_family = AF_UNIX;
- strcpy (addr.sun_path, _PATH_NSCDSOCKET);
- if (__connect (sock, (struct sockaddr *) &addr, sizeof (addr)) < 0)
- {
- __close (sock);
- __set_errno (saved_errno);
- return -1;
- }
-
- return sock;
-}
-
-
static int
internal_function
nscd_getgr_r (const char *key, size_t keylen, request_type type,
struct group *resultbuf, char *buffer, size_t buflen)
{
- int sock = open_socket ();
+ int sock = __nscd_open_socket ();
request_header req;
gr_response_header gr_resp;
ssize_t nbytes;
diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
index bd0be68..9488c53 100644
--- a/nscd/nscd_gethst_r.c
+++ b/nscd/nscd_gethst_r.c
@@ -86,8 +86,8 @@ __nscd_gethostbyaddr_r (const void *addr, socklen_t len, int type,
/* Create a socket connected to a name. */
-static int
-open_socket (void)
+int
+__nscd_open_socket (void)
{
struct sockaddr_un addr;
int sock;
@@ -119,7 +119,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
struct hostent *resultbuf, char *buffer, size_t buflen,
int *h_errnop)
{
- int sock = open_socket ();
+ int sock = __nscd_open_socket ();
hst_response_header hst_resp;
request_header req;
ssize_t nbytes;
diff --git a/nscd/nscd_getpw_r.c b/nscd/nscd_getpw_r.c
index 7e7ed61..abd059e 100644
--- a/nscd/nscd_getpw_r.c
+++ b/nscd/nscd_getpw_r.c
@@ -60,39 +60,13 @@ __nscd_getpwuid_r (uid_t uid, struct passwd *resultbuf, char *buffer,
return nscd_getpw_r (buf, n, GETPWBYUID, resultbuf, buffer, buflen);
}
-/* Create a socket connected to a name. */
-static int
-open_socket (void)
-{
- struct sockaddr_un addr;
- int sock;
- int saved_errno = errno;
-
- sock = __socket (PF_UNIX, SOCK_STREAM, 0);
- if (sock < 0)
- {
- __set_errno (saved_errno);
- return -1;
- }
-
- addr.sun_family = AF_UNIX;
- strcpy (addr.sun_path, _PATH_NSCDSOCKET);
- if (__connect (sock, (struct sockaddr *) &addr, sizeof (addr)) < 0)
- {
- __close (sock);
- __set_errno (saved_errno);
- return -1;
- }
-
- return sock;
-}
static int
internal_function
nscd_getpw_r (const char *key, size_t keylen, request_type type,
struct passwd *resultbuf, char *buffer, size_t buflen)
{
- int sock = open_socket ();
+ int sock = __nscd_open_socket ();
request_header req;
pw_response_header pw_resp;
ssize_t nbytes;