Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/pacman/pacman.c
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-05-13 10:39:33 +0200
committerErich Eckner <git@eckner.net>2021-05-26 17:29:23 +0200
commit740dbbbee7b598060a9d3b51afbb9634e735b56e (patch)
tree343414fa855f19afcaa0947eda0c40f199e07013 /src/pacman/pacman.c
parenta770ad9b975eb441fc21bc982d2938c321da0937 (diff)
change "i686" to "pentium4" if sse2 is available
Diffstat (limited to 'src/pacman/pacman.c')
-rw-r--r--src/pacman/pacman.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 7e810127..cf30325b 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -26,6 +26,7 @@
#include <stdlib.h> /* atoi */
#include <stdio.h>
+#include <cpuid.h>
#include <ctype.h> /* isspace */
#include <limits.h>
#include <getopt.h>
@@ -274,8 +275,18 @@ static void setuseragent(void)
int len;
uname(&un);
+ char machine[8];
+ strncpy(machine, un.machine, 8);
+ if(strcmp(machine, "i686") == 0) {
+ int eax, ebx, ecx, edx;
+ __get_cpuid(1, &eax, &ebx, &ecx, &edx);
+ if (edx & bit_SSE2) {
+ strncpy(machine, "pentium4", sizeof machine);
+ machine[sizeof machine-1] = '\0';
+ }
+ }
len = snprintf(agent, 100, "pacman/%s (%s %s) libalpm/%s",
- PACKAGE_VERSION, un.sysname, un.machine, alpm_version());
+ PACKAGE_VERSION, un.sysname, machine, alpm_version());
if(len >= 100) {
pm_printf(ALPM_LOG_WARNING, _("HTTP_USER_AGENT truncated\n"));
}