chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
[PATCH] DEVPATH for netdev
[elogind.git]
/
klibc
/
klibc
/
gethostname.c
1
/*
2
* gethostname.c
3
*/
4
5
#include <errno.h>
6
#include <unistd.h>
7
#include <string.h>
8
#include <sys/utsname.h>
9
10
int gethostname(char *name, size_t len)
11
{
12
struct utsname un;
13
14
if ( !uname(&un) )
15
return -1;
16
17
if ( len < strlen(un.nodename)+1 ) {
18
errno = EINVAL;
19
return -1;
20
}
21
22
strcpy(name, un.nodename);
23
24
return 0;
25
}