]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: Initialize some return values that could be undefined
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 22 Oct 2024 14:26:41 +0000 (14:26 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 22 Oct 2024 14:26:41 +0000 (14:26 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/config.c
src/libpakfire/file.c
src/libpakfire/key.c
src/libpakfire/progress.c

index 7c1b61117e1ac06c44b9940cc9686b9e6e64f91f..1c0b449e70c5b92b2499b1cba4797f9242d67a68 100644 (file)
@@ -424,7 +424,7 @@ int pakfire_config_has_section(struct pakfire_config* config, const char* name)
 int pakfire_config_read(struct pakfire_config* config, FILE* f) {
        char section[SECTION_MAX_LENGTH] = "";
        char key[KEY_MAX_LENGTH] = "";
-       int r;
+       int r = -EINVAL;
 
        char* line = NULL;
        size_t l = 0;
index 7dbde5b305d2dac25036c183b007fbe46040735f..41af11cfb8dbe4b50f56c9cd9bf0768ce91604a1 100644 (file)
@@ -1883,7 +1883,7 @@ static int pakfire_file_for_elf_section(struct pakfire_file* file,
        Elf_Scn* section = NULL;
        GElf_Shdr shdr;
        Elf_Data* data;
-       int r;
+       int r = -EINVAL;
 
        // Walk through all sections
        for (;;) {
index b12778f804ee7687fe40a3c1fbbf04ce59d1729b..c1f6cf9c57e8902d0501b5993233e03779fb5072 100644 (file)
@@ -951,7 +951,7 @@ static int pakfire_key_read_signature(struct pakfire_key* key,
                struct pakfire_key_signature* signature, FILE* f) {
        void* buffer = NULL;
        size_t buffer_length = 0;
-       int r;
+       int r = -EINVAL;
 
        char* line = NULL;
        size_t length = 0;
index f1d1c6bb9b9f404a422657f3ea904748d42702b8..df62beff836446632564c7a6abfd2c464942a181 100644 (file)
@@ -248,7 +248,7 @@ int pakfire_progress_finish(struct pakfire_progress* p) {
 }
 
 int pakfire_progress_update(struct pakfire_progress* p, unsigned long int value) {
-       int r;
+       int r = -EINVAL;
 
        // Report the change to the parent progress
        if (p->parent) {