On Solaris, uname() returns non-negative value
As per https://docs.oracle.com/cd/E18752_01/html/816-5167/uname-2.html#REFMAN2uname-2 Solaris version of uname() return a non-negative value on success. Modifying this code to check for a return value of less than zero will work on Solaris as well as Linux and AIX.
This commit is contained in:
parent
6969412183
commit
b0174b3dda
@ -238,7 +238,7 @@ static ssize_t pwrite(int fd, void* buf, size_t count, off_t offset) {
|
||||
static void GetHostName(string* hostname) {
|
||||
#if defined(HAVE_SYS_UTSNAME_H)
|
||||
struct utsname buf;
|
||||
if (0 != uname(&buf)) {
|
||||
if (uname(&buf) < 0) {
|
||||
// ensure null termination on failure
|
||||
*buf.nodename = '\0';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user