projects
/
platform
/
upstream
/
linaro-glibc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1bc83d2
)
2001-08-27 Roland McGrath <roland@frob.com>
author
Roland McGrath
<roland@gnu.org>
Sat, 1 Sep 2001 21:45:32 +0000
(21:45 +0000)
committer
Roland McGrath
<roland@gnu.org>
Sat, 1 Sep 2001 21:45:32 +0000
(21:45 +0000)
* sysdeps/unix/sysv/gethostname.c (__gethostname): When LEN is too
short, copy that much into NAME anyway before returning error.
sysdeps/unix/sysv/gethostname.c
patch
|
blob
|
history
diff --git
a/sysdeps/unix/sysv/gethostname.c
b/sysdeps/unix/sysv/gethostname.c
index
ab5f602
..
330770c
100644
(file)
--- a/
sysdeps/unix/sysv/gethostname.c
+++ b/
sysdeps/unix/sysv/gethostname.c
@@
-36,13
+36,13
@@
__gethostname (name, len)
return -1;
node_len = strlen (buf.nodename) + 1;
+ memcpy (name, buf.nodename, len < node_len ? len : node_len);
+
if (node_len > len)
{
__set_errno (ENAMETOOLONG);
return -1;
}
-
- memcpy (name, buf.nodename, node_len);
return 0;
}