about summary refs log tree commit diff
path: root/sysdeps/mach
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/uname.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/uname.c b/sysdeps/mach/hurd/uname.c
index 74d9d3799f..5fac305522 100644
--- a/sysdeps/mach/hurd/uname.c
+++ b/sysdeps/mach/hurd/uname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -25,7 +25,20 @@ uname (struct utsname *uname)
 {
   error_t err;
 
-  err = __USEPORT (PROC, __proc_uname (port, uname));
+  if (err = __USEPORT (PROC, __proc_uname (port, uname)))
+    return __hurd_fail (err);
 
-  return err ? __hurd_fail (err) : 0;
+  /* Fill in the hostname, which the proc server doesn't know.  */
+  err = errno;
+  if (__gethostname (uname.nodename, sizeof uname.nodename) < 0)
+    {
+      if (errno == ENAMETOOLONG)
+	/* Ignore the error of the buffer being too small.
+	   It is of fixed size, nothing to do about it.  */
+	errno = err;
+      else
+	return -1;
+    }
+
+  return 0;
 }