Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
pakfire->nrefs = 1;
pakfire->path = pakfire_strdup(path);
- if (!arch) {
+ if (!arch)
arch = system_machine();
- }
pakfire->arch = pakfire_strdup(arch);
DEBUG("Pakfire initialized at %p\n", pakfire);
- DEBUG(" arch = %s\n", pakfire->arch);
- DEBUG(" path = %s\n", pakfire->path);
+ DEBUG(" arch = %s\n", pakfire_get_arch(pakfire));
+ DEBUG(" path = %s\n", pakfire_get_path(pakfire));
// Initialize the pool
pakfire->pool = pakfire_pool_create(pakfire);
#include <pakfire/util.h>
const char* system_machine() {
- static char __system_machine[STRING_SIZE] = "";
+ static const char* __system_machine = NULL;
- if (!*__system_machine) {
+ if (!__system_machine) {
struct utsname buf;
int r = uname(&buf);
- if (!r)
+ if (r)
return NULL;
- strncpy(__system_machine, buf.machine, sizeof(*__system_machine));
+ __system_machine = pakfire_strdup(buf.machine);
}
return __system_machine;