[Rpm-maint] [rpm-software-management/rpm] Check return value of uname() (#132)

Panu Matilainen notifications at github.com
Sat Jan 21 09:15:06 UTC 2017


It's not the uname() failure itself but what's left uninitialized because of it. On an x86_64 this is enough to get 'rpm -qa' working (without any other patches):

```
--- a/lib/rpmrc.c
+++ b/lib/rpmrc.c
@@ -1018,7 +1018,7 @@ static void defaultMachine(rpmrcCtx ctx, const char ** arch, const char ** os)
            break;
        }
        rc = uname(&un);
-       if (rc < 0) return;
+       if (rc < 0) goto exit;
 
 #if !defined(__linux__)
        if (rstreq(un.sysname, "AIX")) {
@@ -1286,6 +1286,7 @@ static void defaultMachine(rpmrcCtx ctx, const char ** arch, const char ** os)
        break;
     }
 
+exit:
     if (arch) *arch = un.machine;
     if (os) *os = un.sysname;
 }

```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/132#issuecomment-274250081
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20170121/8a9b49a4/attachment.html>


More information about the Rpm-maint mailing list