aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-22 19:52:59 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-22 19:52:59 +0000
commit4c5dd2a2071c60eaa2d36f8a000fb90a5a5a5813 (patch)
treec649760d18479be11f0d3f74aafffcfe906405e4
parentdc2f6455a41f635a6388c2ca4435ecc0d89251fd (diff)
downloadglibc-4c5dd2a2071c60eaa2d36f8a000fb90a5a5a5813.tar
glibc-4c5dd2a2071c60eaa2d36f8a000fb90a5a5a5813.tar.gz
glibc-4c5dd2a2071c60eaa2d36f8a000fb90a5a5a5813.tar.bz2
glibc-4c5dd2a2071c60eaa2d36f8a000fb90a5a5a5813.zip
Update.
2003-04-22 Ulrich Drepper <drepper@redhat.com> * nscd/nscd-client.h: Add declaration for __nscd_open_socket. * nscd/nscd_gethst_r.c (__nscd_open_socket): Renamed from open_socket. Not static anymore. (nscd_gethst_r): Use __nscd_open_socket. * nscd/nscd_getgr_r.c (open_socket): Removed. (nscd_getgr_r): Use __nscd_open_socket. * nscd/nscd_getpw_r.c (open_socket): Removed. (nscd_getpw_r): Use __nscd_open_socket. * nscd/nscd.c (main): Change type of fdn to long int and use strtol. * nscd/connections.c (handle_request): Add cast to avoid warning.
-rw-r--r--ChangeLog14
-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
7 files changed, 25 insertions, 62 deletions
diff --git a/ChangeLog b/ChangeLog
index 35731e575a..4e993c524b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2003-04-22 Ulrich Drepper <drepper@redhat.com>
+
+ * nscd/nscd-client.h: Add declaration for __nscd_open_socket.
+ * nscd/nscd_gethst_r.c (__nscd_open_socket): Renamed from
+ open_socket. Not static anymore.
+ (nscd_gethst_r): Use __nscd_open_socket.
+ * nscd/nscd_getgr_r.c (open_socket): Removed.
+ (nscd_getgr_r): Use __nscd_open_socket.
+ * nscd/nscd_getpw_r.c (open_socket): Removed.
+ (nscd_getpw_r): Use __nscd_open_socket.
+
+ * nscd/nscd.c (main): Change type of fdn to long int and use strtol.
+ * nscd/connections.c (handle_request): Add cast to avoid warning.
+
2003-04-21 Ulrich Drepper <drepper@redhat.com>
* signal/sigfillset.c: Moved to...
diff --git a/nscd/connections.c b/nscd/connections.c
index dd0b2306a4..2e87269d10 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 8e00df5637..be3bc2ffb9 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 97400d1cf1..5844b38407 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 1769ff1c6e..eae2544e12 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 bd0be682d8..9488c53d0f 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 7e7ed619c8..abd059e539 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;