aboutsummaryrefslogtreecommitdiff
path: root/nscd/nscd_getgr_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'nscd/nscd_getgr_r.c')
-rw-r--r--nscd/nscd_getgr_r.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/nscd/nscd_getgr_r.c b/nscd/nscd_getgr_r.c
index f133530f9f..596e31fcde 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;
}