]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Move arch into struct
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Mar 2021 19:42:36 +0000 (19:42 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 10 Mar 2021 19:42:36 +0000 (19:42 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/constants.h
src/libpakfire/pakfire.c

index 24d79a6c1774617cbe1e0361d7e780abf994240c..d8d1c85f2b63609a6ce626ad3e660d0cb9fa26b4 100644 (file)
@@ -24,6 +24,9 @@
 #define _TO_STRING(x) #x
 #define TO_STRING(x) _TO_STRING(x)
 
+// Maximum length of an architecture name
+#define ARCH_MAX                       16
+
 #define STRING_SIZE 1024
 
 #define PAKFIRE_REPO_SYSTEM_NAME "@system"
index d56144bb0209297e4fb1d509ff390f0cd6e5d296..3a00d36ea8ea2c07b6ace80d807cb8dd0a7ccc4a 100644 (file)
@@ -54,7 +54,7 @@
 struct _Pakfire {
        char path[PATH_MAX];
        char cache_path[PATH_MAX];
-       char* arch;
+       char arch[ARCH_MAX];
 
        // Pool stuff
        Pool* pool;
@@ -181,7 +181,7 @@ PAKFIRE_EXPORT int pakfire_create(Pakfire* pakfire, const char* path, const char
        snprintf(p->path, sizeof(p->path) - 1, "%s", path);
 
        // Set architecture
-       p->arch = strdup(arch);
+       snprintf(p->arch, sizeof(p->arch) - 1, "%s", arch);
 
        // Setup logging
        p->log_function = pakfire_log_syslog;