9 #ifdef HAVE_SYS_UTSNAME_H
10 #include <sys/utsname.h>
15 #include "osdep/sysname.h"
16 #include "util/memory.h"
17 #include "util/string.h"
20 unsigned char system_name
[MAX_STR_LEN
];
24 got_it_from_uname_command(void)
29 f
= popen("uname -srm", "r");
32 if (fread(system_name
, 1, sizeof(system_name
) - 1, f
) <= 0) {
39 system_name
[MAX_STR_LEN
- 1] = '\0'; /* Safer. */
41 while (*p
>= ' ') p
++;
50 #define got_it_from_uname_command() 0
56 #if defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME)
60 snprintf(system_name
, sizeof(system_name
),
61 "%s %s %s", name
.sysname
, name
.release
, name
.machine
);
66 if (got_it_from_uname_command()) return;
68 safe_strncpy(system_name
, SYSTEM_NAME
, sizeof(system_name
));