coreutils/coreutils-8.14-uname-1.patch

56 lines
1.6 KiB
Diff

Submitted by: William Immendorf <will.immendorf@gmail.com>
Date: 2010-05-08
Inital Package Version: 8.5
Origin: http://cvs.fedoraproject.org/viewvc/devel/coreutils/coreutils-8.2-uname-processortype.patch
Upstream Status: Rejected
Description: Fixes the output of uname's -i and -p parameters
diff -Naur coreutils-8.5.orig/src/uname.c coreutils-8.5/src/uname.c
--- coreutils-8.5.orig/src/uname.c 2010-05-08 11:50:59.153186845 -0500
+++ coreutils-8.5/src/uname.c 2010-05-08 11:51:14.254062912 -0500
@@ -301,13 +301,19 @@
if (toprint & PRINT_PROCESSOR)
{
- char const *element = unknown;
+ char *element = unknown;
#if HAVE_SYSINFO && defined SI_ARCHITECTURE
{
static char processor[257];
if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
element = processor;
}
+#else
+ {
+ struct utsname u;
+ uname(&u);
+ element = u.machine;
+ }
#endif
#ifdef UNAME_PROCESSOR
if (element == unknown)
@@ -345,7 +351,7 @@
if (toprint & PRINT_HARDWARE_PLATFORM)
{
- char const *element = unknown;
+ char *element = unknown;
#if HAVE_SYSINFO && defined SI_PLATFORM
{
static char hardware_platform[257];
@@ -353,6 +359,14 @@
hardware_platform, sizeof hardware_platform))
element = hardware_platform;
}
+#else
+ {
+ struct utsname u;
+ uname(&u);
+ element = u.machine;
+ if(strlen(element)==4 && element[0]=='i' && element[2]=='8' && element[3]=='6')
+ element[1]='3';
+ }
#endif
#ifdef UNAME_HARDWARE_PLATFORM
if (element == unknown)