1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Remove getdomainname(2).

This commit is contained in:
Jonas 'Sortie' Termansen 2016-04-06 13:27:41 +02:00
parent 1ef3c31f81
commit 2a6a246ff4
5 changed files with 2 additions and 42 deletions

View file

@ -671,7 +671,6 @@ unistd/fsync.o \
unistd/ftruncate.o \
unistd/get_current_dir_name.o \
unistd/getcwd.o \
unistd/getdomainname.o \
unistd/getegid.o \
unistd/getentropy.o \
unistd/geteuid.o \

View file

@ -39,7 +39,6 @@ struct utsname
char processor[_UTSNAME_LENGTH];
char hwplatform[_UTSNAME_LENGTH];
char opsysname[_UTSNAME_LENGTH];
char domainname[_UTSNAME_LENGTH];
};
int uname(struct utsname*);

View file

@ -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
* 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 execvpe(const char*, char* const [], char* const []);
char* get_current_dir_name(void);
int getdomainname(char*, size_t);
int getentropy(void*, size_t);
int pipe2(int [2], int);
int sethostname(const char*, size_t);

View file

@ -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
* 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->hwplatform, hwplatform, sizeof(name->hwplatform));
strlcpy(name->opsysname, opsysname, sizeof(name->opsysname));
if ( getdomainname(name->domainname, sizeof(name->domainname)) < 0 )
strlcpy(name->domainname, "unknown", sizeof(name->domainname));
return 0;
}

View file

@ -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;
}