[klibc] [PATCH] klibc: fix gethostname()/getdomainname()

Maciej Żenczykowski zenczykowski at gmail.com
Wed Jun 27 18:07:02 PDT 2012


From: Maciej Żenczykowski <maze at google.com>

uname(2) returns (like all syscalls) 0 on success.

Signed-off-by: Maciej Żenczykowski <maze at google.com>
---
 usr/klibc/getdomainname.c |    2 +-
 usr/klibc/gethostname.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr/klibc/getdomainname.c b/usr/klibc/getdomainname.c
index 61722ca3519b..218ff0baa871 100644
--- a/usr/klibc/getdomainname.c
+++ b/usr/klibc/getdomainname.c
@@ -11,7 +11,7 @@ int getdomainname(char *name, size_t len)
 {
 	struct utsname un;
 
-	if (!uname(&un))
+	if (uname(&un))
 		return -1;
 
 	if (len < strlen(un.domainname) + 1) {
diff --git a/usr/klibc/gethostname.c b/usr/klibc/gethostname.c
index 5326b5fc4eb9..120edd943170 100644
--- a/usr/klibc/gethostname.c
+++ b/usr/klibc/gethostname.c
@@ -11,7 +11,7 @@ int gethostname(char *name, size_t len)
 {
 	struct utsname un;
 
-	if (!uname(&un))
+	if (uname(&un))
 		return -1;
 
 	if (len < strlen(un.nodename) + 1) {
-- 
1.7.9.4



More information about the klibc mailing list