repo.or.cz
/
musl.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
delete a redundant if in dynamic linker ctor execution loop
[musl.git]
/
src
/
misc
/
getdomainname.c
blob
59df566d9465625f28f47dcdaf979cf44c5681a7
1
#define _GNU_SOURCE
2
#include <unistd.h>
3
#include <sys/utsname.h>
4
#include <string.h>
5
#include <errno.h>
6
7
int
getdomainname
(
char
*
name
,
size_t
len
)
8
{
9
struct
utsname temp
;
10
uname
(&
temp
);
11
if
(!
len
||
strlen
(
temp
.
domainname
) >=
len
) {
12
errno
=
EINVAL
;
13
return
-
1
;
14
}
15
strcpy
(
name
,
temp
.
domainname
);
16
return
0
;
17
}