summaryrefslogtreecommitdiff
path: root/lib/xgethostname.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xgethostname.c')
-rw-r--r--lib/xgethostname.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/xgethostname.c b/lib/xgethostname.c
index ec00373fb..5178784ba 100644
--- a/lib/xgethostname.c
+++ b/lib/xgethostname.c
@@ -72,7 +72,9 @@ xgethostname ()
break;
else if (err < 0 && errno != ENAMETOOLONG && errno != 0)
{
+ int saved_errno = errno;
free (hostname);
+ errno = saved_errno;
return NULL;
}
size *= 2;