diff options
author | Jim Meyering <jim@meyering.net> | 2005-02-20 16:33:03 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2005-02-20 16:33:03 +0000 |
commit | 84c616fa90166ec9ff0934b65b637d8423f63e2a (patch) | |
tree | 8e7d631cb3a34a3e2b34c9b8b45618667ae7b14f | |
parent | c922e787b432e0b1f90dd26055e67d2a4ee471c7 (diff) | |
download | coreutils-84c616fa90166ec9ff0934b65b637d8423f63e2a.tar.xz |
(xgethostname): Check for ENOMEM, which is
returned by OSX/Darwin if the specified buffer is not large
enough for the hostname.
-rw-r--r-- | lib/xgethostname.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/xgethostname.c b/lib/xgethostname.c index 7b29176f2..195a3750c 100644 --- a/lib/xgethostname.c +++ b/lib/xgethostname.c @@ -1,6 +1,6 @@ /* xgethostname.c -- return current hostname with unlimited length - Copyright (C) 1992, 1996, 2000, 2001, 2003, 2004 Free Software + Copyright (C) 1992, 1996, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -69,7 +69,9 @@ xgethostname (void) if (! hostname[size_1 - 1]) break; } - else if (errno != 0 && errno != ENAMETOOLONG && errno != EINVAL) + else if (errno != 0 && errno != ENAMETOOLONG && errno != EINVAL + /* OSX/Darwin does this when the buffer is not large enough */ + && errno != ENOMEM) { int saved_errno = errno; free (hostname); |