Sophie

Sophie

distrib > Mandriva > 2008.0 > x86_64 > by-pkgid > a35732d620cfac4812adc8d6b2992f07 > files > 47

rpm-4.4.8-22.1mdv2008.0.src.rpm

--- rpm-4.4.8/lib/rpmrc.c.linux32	2007-09-06 15:37:57.000000000 +0200
+++ rpm-4.4.8/lib/rpmrc.c	2007-09-06 18:07:59.000000000 +0200
@@ -6,6 +6,8 @@
 #include <setjmp.h>
 #endif
 
+#include <sys/personality.h>
+
 #if HAVE_SYS_SYSTEMCFG_H
 #include <sys/systemcfg.h>
 #else
@@ -31,6 +33,7 @@ static const char * configTarget = NULL;
 
 /*@observer@*/ /*@unchecked@*/
 static const char * platform = "/etc/rpm/platform";
+static const char * platform32 = "/etc/rpm/platform32";
 /*@only@*/ /*@relnull@*/ /*@unchecked@*/
 void * platpat = NULL;
 /*@unchecked@*/
@@ -981,7 +984,7 @@ static int mireAppend(rpmMireMode mode, 
  * @return		0 on success
  */
 /*@-bounds@*/
-static int rpmPlatform(const char * platform)
+static int rpmPlatform(const char * platform, const char * platform32)
 	/*@globals nplatpat, platpat,
 		rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
 	/*@modifies nplatpat, platpat,
@@ -994,10 +997,15 @@ static int rpmPlatform(const char * plat
     miRE mi_re = NULL;
     int mi_nre = 0;
     char * p, * pe;
-    int rc;
+    int rc = 1;
     int xx;
 
-    rc = rpmioSlurp(platform, &b, &blen);
+    /* if personality is LINUX32, try to use platform32 if it exists */
+    if ((personality(0xffffffff) & PER_MASK) == PER_LINUX32) {
+        rc = rpmioSlurp(platform32, &b, &blen);
+    }
+    if (rc != 0)
+        rc = rpmioSlurp(platform, &b, &blen);
 
     if (rc || b == NULL || blen <= 0) {
 	rc = -1;
@@ -1297,7 +1305,7 @@ static void defaultMachine(/*@out@*/ con
 	CVOG_t cvog = NULL;
 	rc = uname(&un);
 	if (rc < 0) return;
-	if (!rpmPlatform(platform)) {
+	if (!rpmPlatform(platform, platform32)) {
 	    const char * s;
 	    gotDefaults = 1;
 	    s = rpmExpand("%{?_host_cpu}", NULL);