Use gethostname(3) to obtain the local host name, as opposed to uname(3).
Otherwise the length of the name is limited to 32 characters only.
This commit is contained in:
parent
3977d3f488
commit
09caeadeda
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=36617
@ -19,7 +19,7 @@ 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.
|
||||
|
||||
$Id: bootpd.c,v 1.6 1997/02/22 14:21:02 peter Exp $
|
||||
$Id: bootpd.c,v 1.7 1997/05/11 14:27:03 phk Exp $
|
||||
|
||||
************************************************************************/
|
||||
|
||||
@ -162,8 +162,7 @@ char *progname;
|
||||
char *chdir_path;
|
||||
struct in_addr my_ip_addr;
|
||||
|
||||
struct utsname my_uname;
|
||||
char *hostname;
|
||||
char *hostname, default_hostname[MAXHOSTNAMELEN + 1];
|
||||
|
||||
/* Flags set by signal catcher. */
|
||||
PRIVATE int do_readtab = 0;
|
||||
@ -256,11 +255,11 @@ main(argc, argv)
|
||||
stmp = NULL;
|
||||
timeout = &actualtimeout;
|
||||
|
||||
if (uname(&my_uname) < 0) {
|
||||
if (gethostname(default_hostname, MAXHOSTNAMELEN) < 0) {
|
||||
report(LOG_ERR, "bootpd: can't get hostname\n");
|
||||
exit(1);
|
||||
}
|
||||
hostname = my_uname.nodename;
|
||||
hostname = default_hostname;
|
||||
|
||||
/*
|
||||
* Read switches.
|
||||
|
Loading…
Reference in New Issue
Block a user