coreutils/coreutils-sysinfo.patch
Bernhard Voelker a296bffe53 - coreutils-i18n.patch: fold(1): fix exit code for non-existent file.
The exit code of fold(1) was zero for non-existent file:
    $ fold badfile; echo $?
    fold: badfile: No such file or directory
    0

  * coreutils-i18n.patch (src/fold.c:fold_file): Fix incorrect return code
  for non-existent files; the I18N patch incorrectly returned an integer
  instead of a bool on failure.
  While at it, also fix the assignment to 'have_read_stdin' to bool.

  The bug was introduced by the downstrean I18N patch. (rhbz#2296201)
  Based on patch by Sohum Mendon <sohum.mendon@proton.me>.

OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=364
2024-07-10 21:09:17 +00:00

65 lines
1.8 KiB
Diff

---
src/uname.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
Index: src/uname.c
===================================================================
--- src/uname.c.orig
+++ src/uname.c
@@ -341,6 +341,36 @@ main (int argc, char **argv)
element = processor;
}
#endif
+ if (element == unknown)
+ {
+ struct utsname name;
+ static char processor[sizeof (name.machine)];
+ if (uname (&name) != 0)
+ error (EXIT_FAILURE, errno, _("cannot get system name"));
+ strcpy (processor, name.machine);
+ element = processor;
+#ifdef __linux__
+ if (!strcmp (element, "i686"))
+ {
+ /* Check for Athlon */
+ char line[1024];
+ FILE *f = fopen ("/proc/cpuinfo", "r");
+ if (f)
+ {
+ while (fgets (line, sizeof (line), f) > 0)
+ {
+ if (strncmp (line, "vendor_id", 9) == 0)
+ {
+ if (strstr (line, "AuthenticAMD"))
+ element = "athlon";
+ break;
+ }
+ }
+ fclose (f);
+ }
+ }
+#endif
+ }
if (! (toprint == UINT_MAX && element == unknown))
print_element (element);
}
@@ -366,6 +396,18 @@ main (int argc, char **argv)
element = hardware_platform;
}
#endif
+ if (element == unknown)
+ {
+ struct utsname name;
+ static char hardware_platform[sizeof (name.machine)];
+ if (uname (&name) != 0)
+ error (EXIT_FAILURE, errno, _("cannot get system name"));
+ strcpy (hardware_platform, name.machine);
+ if (hardware_platform[0] == 'i' && hardware_platform[2] == '8'
+ && hardware_platform[3] == '6' && hardware_platform[4] == 0)
+ hardware_platform[1] = '3';
+ element = hardware_platform;
+ }
if (! (toprint == UINT_MAX && element == unknown))
print_element (element);
}