cvs commit: patches/coreutils coreutils-5.2.1-uname-1.patch

tushar at linuxfromscratch.org tushar at linuxfromscratch.org
Sat Mar 27 16:12:37 PST 2004


tushar      04/03/27 17:12:37

  Added:       coreutils coreutils-5.2.1-uname-1.patch
  Log:
  Added: coreutils-5.2.1-uname-1.patch
  
  Revision  Changes    Path
  1.1                  patches/coreutils/coreutils-5.2.1-uname-1.patch
  
  Index: coreutils-5.2.1-uname-1.patch
  ===================================================================
  Submitted By: Robert Connolly <cendres at videotron dot ca> (ashes)
  Date: 2004-03-27
  Initial Package Version: 5.2.1
  Origin: lfs coreutils-5.0-uname.patch
  Description: Adds functions to uname to fix 'unknown' to display something usefull.
  
  diff -Naur coreutils-5.2.0.orig/src/uname.c coreutils-5.2.0/src/uname.c
  --- coreutils-5.2.0.orig/src/uname.c	2004-02-28 04:52:41.010401088 +0000
  +++ coreutils-5.2.0/src/uname.c	2004-02-28 05:20:18.453431448 +0000
  @@ -243,13 +243,19 @@
     if (toprint & PRINT_PROCESSOR)
       {
         char const *element = unknown;
  -#if HAVE_SYSINFO && defined SI_ARCHITECTURE
  -      {
  -	static char processor[257];
  -	if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
  -	  element = processor;
  +      char processor[BUFSIZ]="unknown";
  +      FILE *ffd;
  +      char temp_string[BUFSIZ];
  +
  +      if ((ffd=fopen("/proc/cpuinfo", "r") )!=NULL) {
  +              while ( fscanf(ffd, "%s :", temp_string) != EOF)
  +                      if (!(strcmp(temp_string, "vendor_id"))) {
  +                                      fscanf(ffd, "%s", processor);
  +                                      break;
  +                      }
  +              fclose(ffd);
         }
  -#endif
  +      element = processor;
   #ifdef UNAME_PROCESSOR
         if (element == unknown)
   	{
  
  
  



More information about the patches mailing list