uml: host_info tidying
[powerpc.git] / arch / um / os-Linux / util.c
index 3f5b151..125854a 100644 (file)
@@ -80,24 +80,29 @@ void setup_machinename(char *machine_out)
        struct utsname host;
 
        uname(&host);
-#if defined(UML_CONFIG_UML_X86) && !defined(UML_CONFIG_64BIT)
+#ifdef UML_CONFIG_UML_X86
+# ifndef UML_CONFIG_64BIT
        if (!strcmp(host.machine, "x86_64")) {
                strcpy(machine_out, "i686");
                return;
        }
+# else
+       if (!strcmp(host.machine, "i686")) {
+               strcpy(machine_out, "x86_64");
+               return;
+       }
+# endif
 #endif
        strcpy(machine_out, host.machine);
 }
 
-char host_info[(_UTSNAME_LENGTH + 1) * 4 + _UTSNAME_NODENAME_LENGTH + 1];
-
-void setup_hostinfo(void)
+void setup_hostinfo(char *buf, int len)
 {
        struct utsname host;
 
        uname(&host);
-       sprintf(host_info, "%s %s %s %s %s", host.sysname, host.nodename,
-               host.release, host.version, host.machine);
+       snprintf(buf, len, "%s %s %s %s %s", host.sysname, host.nodename,
+                host.release, host.version, host.machine);
 }
 
 int setjmp_wrapper(void (*proc)(void *, void *), ...)