/* xgetdomainname.c -- Return the NIS domain name, without size limitations.
- Copyright (C) 1992, 1996, 2000-2001, 2003-2004, 2006, 2008 Free Software
- Foundation, Inc.
+ Copyright (C) 1992, 1996, 2000-2001, 2003-2004, 2006, 2008-2011 Free
+ Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
domainname[k] = '\0';
err = getdomainname (domainname, size);
if (err >= 0 && domainname[k] == '\0')
- break;
+ break;
else if (err < 0 && errno != EINVAL)
- {
- int saved_errno = errno;
- free (domainname);
- errno = saved_errno;
- return NULL;
- }
+ {
+ int saved_errno = errno;
+ free (domainname);
+ errno = saved_errno;
+ return NULL;
+ }
size *= 2;
domainname = xrealloc (domainname, size);
}