1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

* posix.c (scm_gethostname): Preserve errno across free() call.

This commit is contained in:
Kevin Ryde 2004-03-19 23:17:00 +00:00
parent 726f82e747
commit 228651245d

View file

@ -1748,7 +1748,7 @@ SCM_DEFINE (scm_gethostname, "gethostname", 0, 0, 0,
{
/* 256 is for Solaris, under Linux ENAMETOOLONG is returned if not
large enough. */
int len = 256, res;
int len = 256, res, save_errno;
char *p = scm_malloc (len);
SCM name;
@ -1761,7 +1761,9 @@ SCM_DEFINE (scm_gethostname, "gethostname", 0, 0, 0,
}
if (res == -1)
{
save_errno = errno;
free (p);
errno = save_errno;
SCM_SYSERROR;
}
name = scm_makfrom0str (p);