diff options
-rw-r--r-- | src/unistd/gethostname.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/unistd/gethostname.c b/src/unistd/gethostname.c index f984b7dd..633ef571 100644 --- a/src/unistd/gethostname.c +++ b/src/unistd/gethostname.c @@ -8,6 +8,6 @@ int gethostname(char *name, size_t len) if (uname(&uts)) return -1; if (len > sizeof uts.nodename) len = sizeof uts.nodename; for (i=0; i<len && (name[i] = uts.nodename[i]); i++); - if (i==len) name[i-1] = 0; + if (i && i==len) name[i-1] = 0; return 0; } |