diff options
author | nate <nate@FreeBSD.org> | 1996-06-08 06:01:29 +0000 |
---|---|---|
committer | nate <nate@FreeBSD.org> | 1996-06-08 06:01:29 +0000 |
commit | c8e7c06a293dc0edc05652ba5598309fa798e818 (patch) | |
tree | c951575ff78d89d491e671b4f5d2c320eac9c73c /sys/i386 | |
parent | 868a754d52f804f73cfb5a0aba9e612fb19a39b8 (diff) | |
download | FreeBSD-src-c8e7c06a293dc0edc05652ba5598309fa798e818.zip FreeBSD-src-c8e7c06a293dc0edc05652ba5598309fa798e818.tar.gz |
When uname() returns the system name, try to use the unqualified domain
name (ie; strip off the domain). Given a hostname 'fooey.bar.com', the
previous code returned a system name of 'fooey.ba', instead of the more
correct 'fooey'. SCO uses 'uname' for many things, including some of
it's socket code so this patch is necessary for running certain legacy
SCO apps. :)
A variant of this code has been running on my box for 2 months now.
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/ibcs2/ibcs2_stat.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/i386/ibcs2/ibcs2_stat.c b/sys/i386/ibcs2/ibcs2_stat.c index f01280c..9d8ce85 100644 --- a/sys/i386/ibcs2/ibcs2_stat.c +++ b/sys/i386/ibcs2/ibcs2_stat.c @@ -231,13 +231,18 @@ ibcs2_utssys(p, uap, retval) switch (SCARG(uap, flag)) { case 0: /* uname(2) */ { + char machine_name[9], *p; struct ibcs2_utsname sut; bzero(&sut, ibcs2_utsname_len); strncpy(sut.sysname, IBCS2_UNAME_SYSNAME, sizeof(sut.sysname)); strncpy(sut.release, IBCS2_UNAME_RELEASE, sizeof(sut.release)); strncpy(sut.version, IBCS2_UNAME_VERSION, sizeof(sut.version)); - strncpy(sut.nodename, hostname, sizeof(sut.nodename)); + strncpy(machine_name, hostname, sizeof(machine_name)); + p = index(machine_name, '.'); + if ( p ) + *p = '\0'; + strncpy(sut.nodename, machine_name, sizeof(sut.nodename)); strncpy(sut.machine, machine, sizeof(sut.machine)); sut.sysname[sizeof(sut.sysname)-1] = '\0'; sut.release[sizeof(sut.release)-1] = '\0'; |