Ticket #2643: coreutils-8.5-uname-1.patch

File coreutils-8.5-uname-1.patch, 1.6 KB (added by willimm, 15 years ago)

Coreutils Uname Patch. Note, this is not the same one in that is currently in the book, it's a cleaner version from Fedora that basically does the same thing as the old patch.

  • coreutils-8.5

    Submitted by: William Immendorf <will.immendorf@gmail.com>
    Date: 2010-05-08
    Inital Package Version: 8.5
    Origion: Fedora CVS, used coreutils-8.2-uname-processortype.patch.
    Upstream Status: Rejected
    Description: Fixes uname's functionally once and for all. Unlike the old hacky patch, this one is cleaner and also fixes the functionally of -i as well as -p.
    
    diff -Naur coreutils-8.5.orig/src/uname.c coreutils-8.5/src/uname.c
    old new  
    301301
    302302  if (toprint & PRINT_PROCESSOR)
    303303    {
    304       char const *element = unknown;
     304      char *element = unknown;
    305305#if HAVE_SYSINFO && defined SI_ARCHITECTURE
    306306      {
    307307        static char processor[257];
    308308        if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
    309309          element = processor;
    310310      }
     311#else
     312      {
     313        struct utsname u;
     314        uname(&u);
     315        element = u.machine;
     316      }
    311317#endif
    312318#ifdef UNAME_PROCESSOR
    313319      if (element == unknown)
     
    345351
    346352  if (toprint & PRINT_HARDWARE_PLATFORM)
    347353    {
    348       char const *element = unknown;
     354      char *element = unknown;
    349355#if HAVE_SYSINFO && defined SI_PLATFORM
    350356      {
    351357        static char hardware_platform[257];
     
    353359                          hardware_platform, sizeof hardware_platform))
    354360          element = hardware_platform;
    355361      }
     362#else
     363      {
     364        struct utsname u;
     365        uname(&u);
     366        element = u.machine;
     367        if(strlen(element)==4 && element[0]=='i' && element[2]=='8' && element[3]=='6')
     368                element[1]='3';
     369      }
    356370#endif
    357371#ifdef UNAME_HARDWARE_PLATFORM
    358372      if (element == unknown)