1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-19 06:50:11 +03:00
systemd-stable/klibc/klibc/getdomainname.c
greg@kroah.com a41a0e28c2 [PATCH] added klibc version 0.82 (cvs tree) to the udev tree.
Not hooked up to the build yet.
2005-04-26 21:05:23 -07:00

26 lines
342 B
C

/*
* getdomainname.c
*/
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/utsname.h>
int getdomainname(char *name, size_t len)
{
struct utsname un;
if ( !uname(&un) )
return -1;
if ( len < strlen(un.domainname)+1 ) {
errno = EINVAL;
return -1;
}
strcpy(name, un.domainname);
return 0;
}