aboutsummaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
Diffstat (limited to 'nscd')
-rw-r--r--nscd/nscd_getgr_r.c7
-rw-r--r--nscd/nscd_getpw_r.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/nscd/nscd_getgr_r.c b/nscd/nscd_getgr_r.c
index f133530..596e31f 100644
--- a/nscd/nscd_getgr_r.c
+++ b/nscd/nscd_getgr_r.c
@@ -67,16 +67,21 @@ nscd_open_socket (void)
{
struct sockaddr_un addr;
int sock;
+ int saved_errno = errno;
sock = socket (PF_UNIX, SOCK_STREAM, 0);
if (sock < 0)
- return -1;
+ {
+ __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;
}
diff --git a/nscd/nscd_getpw_r.c b/nscd/nscd_getpw_r.c
index c956abc..4fc78e1 100644
--- a/nscd/nscd_getpw_r.c
+++ b/nscd/nscd_getpw_r.c
@@ -67,16 +67,21 @@ nscd_open_socket (void)
{
struct sockaddr_un addr;
int sock;
+ int saved_errno = errno;
sock = socket (PF_UNIX, SOCK_STREAM, 0);
if (sock < 0)
- return -1;
+ {
+ __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;
}