Remove getdomainname(2).
This commit is contained in:
parent
1ef3c31f81
commit
2a6a246ff4
|
@ -671,7 +671,6 @@ unistd/fsync.o \
|
||||||
unistd/ftruncate.o \
|
unistd/ftruncate.o \
|
||||||
unistd/get_current_dir_name.o \
|
unistd/get_current_dir_name.o \
|
||||||
unistd/getcwd.o \
|
unistd/getcwd.o \
|
||||||
unistd/getdomainname.o \
|
|
||||||
unistd/getegid.o \
|
unistd/getegid.o \
|
||||||
unistd/getentropy.o \
|
unistd/getentropy.o \
|
||||||
unistd/geteuid.o \
|
unistd/geteuid.o \
|
||||||
|
|
|
@ -39,7 +39,6 @@ struct utsname
|
||||||
char processor[_UTSNAME_LENGTH];
|
char processor[_UTSNAME_LENGTH];
|
||||||
char hwplatform[_UTSNAME_LENGTH];
|
char hwplatform[_UTSNAME_LENGTH];
|
||||||
char opsysname[_UTSNAME_LENGTH];
|
char opsysname[_UTSNAME_LENGTH];
|
||||||
char domainname[_UTSNAME_LENGTH];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int uname(struct utsname*);
|
int uname(struct utsname*);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2012, 2013, 2014, 2015 Jonas 'Sortie' Termansen.
|
* Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 Jonas 'Sortie' Termansen.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -548,7 +548,6 @@ int crypt_newhash(const char*, const char*, char*, size_t);
|
||||||
int dup3(int, int, int);
|
int dup3(int, int, int);
|
||||||
int execvpe(const char*, char* const [], char* const []);
|
int execvpe(const char*, char* const [], char* const []);
|
||||||
char* get_current_dir_name(void);
|
char* get_current_dir_name(void);
|
||||||
int getdomainname(char*, size_t);
|
|
||||||
int getentropy(void*, size_t);
|
int getentropy(void*, size_t);
|
||||||
int pipe2(int [2], int);
|
int pipe2(int [2], int);
|
||||||
int sethostname(const char*, size_t);
|
int sethostname(const char*, size_t);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2015 Jonas 'Sortie' Termansen.
|
* Copyright (c) 2014, 2015, 2016 Jonas 'Sortie' Termansen.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -63,7 +63,5 @@ int uname(struct utsname* name)
|
||||||
strlcpy(name->processor, processor, sizeof(name->processor));
|
strlcpy(name->processor, processor, sizeof(name->processor));
|
||||||
strlcpy(name->hwplatform, hwplatform, sizeof(name->hwplatform));
|
strlcpy(name->hwplatform, hwplatform, sizeof(name->hwplatform));
|
||||||
strlcpy(name->opsysname, opsysname, sizeof(name->opsysname));
|
strlcpy(name->opsysname, opsysname, sizeof(name->opsysname));
|
||||||
if ( getdomainname(name->domainname, sizeof(name->domainname)) < 0 )
|
|
||||||
strlcpy(name->domainname, "unknown", sizeof(name->domainname));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2014 Jonas 'Sortie' Termansen.
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
|
||||||
* copyright notice and this permission notice appear in all copies.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*
|
|
||||||
* unistd/getdomainname.c
|
|
||||||
* Get the domainname.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
int getdomainname(char* name, size_t len)
|
|
||||||
{
|
|
||||||
const char* domainname = getenv("DOMAINNAME");
|
|
||||||
if ( !domainname )
|
|
||||||
domainname = "localdomain";
|
|
||||||
size_t domainname_len = strlen(domainname);
|
|
||||||
if ( len < domainname_len+1 )
|
|
||||||
return errno = ENAMETOOLONG, -1;
|
|
||||||
strcpy(name, domainname);
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in New Issue