From: Michael Tremer Date: Mon, 29 Jan 2024 17:50:22 +0000 (+0000) Subject: file: Remove the legacy logger X-Git-Tag: 0.9.30~1230 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c3e5b4e6078df720ce7d90b29f9957d370d4da4f;p=pakfire.git file: Remove the legacy logger Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/file.c b/src/libpakfire/file.c index 9e73b2788..c096c5dbd 100644 --- a/src/libpakfire/file.c +++ b/src/libpakfire/file.c @@ -35,9 +35,6 @@ #include -// Enable legacy logging -#define PAKFIRE_LEGACY_LOGGING - #include #include #include @@ -138,7 +135,7 @@ static int pakfire_file_read_fcaps(struct pakfire_file* file, // Allocate capabilities file->caps = cap_init(); if (!file->caps) { - ERROR(file->pakfire, "Could not allocate capabilities: %m\n"); + CTX_ERROR(file->ctx, "Could not allocate capabilities: %m\n"); r = 1; goto ERROR; } @@ -172,7 +169,7 @@ static int pakfire_file_read_fcaps(struct pakfire_file* file, if (cap_permitted) { r = cap_set_flag(file->caps, CAP_PERMITTED, 1, caps, CAP_SET); if (r) { - ERROR(file->pakfire, "Could not set capability %u: %m\n", cap); + CTX_ERROR(file->ctx, "Could not set capability %u: %m\n", cap); goto ERROR; } } @@ -180,7 +177,7 @@ static int pakfire_file_read_fcaps(struct pakfire_file* file, if (cap_inheritable) { r = cap_set_flag(file->caps, CAP_INHERITABLE, 1, caps, CAP_SET); if (r) { - ERROR(file->pakfire, "Could not set capability %u: %m\n", cap); + CTX_ERROR(file->ctx, "Could not set capability %u: %m\n", cap); goto ERROR; } } @@ -188,7 +185,7 @@ static int pakfire_file_read_fcaps(struct pakfire_file* file, if (cap_effective) { r = cap_set_flag(file->caps, CAP_EFFECTIVE, 1, caps, CAP_SET); if (r) { - ERROR(file->pakfire, "Could not set capability %u: %m\n", cap); + CTX_ERROR(file->ctx, "Could not set capability %u: %m\n", cap); goto ERROR; } } @@ -197,7 +194,7 @@ static int pakfire_file_read_fcaps(struct pakfire_file* file, #ifdef ENABLE_DEBUG char* text = cap_to_text(file->caps, NULL); if (text) { - DEBUG(file->pakfire, "%s: Capabilities %s\n", pakfire_file_get_path(file), text); + CTX_DEBUG(file->ctx, "%s: Capabilities %s\n", pakfire_file_get_path(file), text); cap_free(text); } #endif @@ -235,21 +232,21 @@ int pakfire_file_write_fcaps(struct pakfire_file* file, struct vfs_cap_data* cap // Fetch CAP_PERMITTED r = cap_get_flag(file->caps, cap, CAP_PERMITTED, &cap_permitted); if (r) { - ERROR(file->pakfire, "Could not fetch capability %u: %m\n", cap); + CTX_ERROR(file->ctx, "Could not fetch capability %u: %m\n", cap); goto ERROR; } // Fetch CAP_INHERITABLE r = cap_get_flag(file->caps, cap, CAP_INHERITABLE, &cap_inheritable); if (r) { - ERROR(file->pakfire, "Could not fetch capability %u: %m\n", cap); + CTX_ERROR(file->ctx, "Could not fetch capability %u: %m\n", cap); goto ERROR; } // Fetch CAP_EFFECTIVE r = cap_get_flag(file->caps, cap, CAP_EFFECTIVE, &cap_effective); if (r) { - ERROR(file->pakfire, "Could not fetch capability %u: %m\n", cap); + CTX_ERROR(file->ctx, "Could not fetch capability %u: %m\n", cap); goto ERROR; } @@ -355,7 +352,7 @@ static int pakfire_file_from_archive_entry(struct pakfire_file* file, struct arc goto ERROR; } else { - DEBUG(file->pakfire, "Received an unknown extended attribute: %s\n", attr); + CTX_DEBUG(file->ctx, "Received an unknown extended attribute: %s\n", attr); } } @@ -404,7 +401,7 @@ int pakfire_file_read(struct pakfire_file* file, struct archive* reader, const c // Read everything r = archive_read_disk_entry_from_file(reader, file->entry, -1, NULL); if (r) { - ERROR(file->pakfire, "Could not read %s: %s\n", path, archive_error_string(reader)); + CTX_ERROR(file->ctx, "Could not read %s: %s\n", path, archive_error_string(reader)); return 1; } @@ -501,7 +498,7 @@ struct archive_entry* pakfire_file_archive_entry(struct pakfire_file* file, int if (file->caps) { r = pakfire_file_write_fcaps(file, &cap_data); if (r) { - ERROR(file->pakfire, "Could not export capabilities: %m\n"); + CTX_ERROR(file->ctx, "Could not export capabilities: %m\n"); goto ERROR; } @@ -863,7 +860,7 @@ PAKFIRE_EXPORT int pakfire_file_set_path(struct pakfire_file* file, const char* return r; ERROR: - ERROR(file->pakfire, "Could not set path '%s': %m\n", path); + CTX_ERROR(file->ctx, "Could not set path '%s': %m\n", path); return r; } @@ -1047,7 +1044,7 @@ PAKFIRE_EXPORT int pakfire_file_set_digest(struct pakfire_file* file, // Check buffer length if (pakfire_digest_length(type) != length) { - ERROR(file->pakfire, "Digest has an incorrect length of %zu byte(s)\n", length); + CTX_ERROR(file->ctx, "Digest has an incorrect length of %zu byte(s)\n", length); return -ENOMSG; } @@ -1100,7 +1097,7 @@ PAKFIRE_EXPORT char* pakfire_file_get_caps(struct pakfire_file* file) { if (file->caps) { text = cap_to_text(file->caps, &length); if (!text) { - ERROR(file->pakfire, "Could not export capabilities: %m\n"); + CTX_ERROR(file->ctx, "Could not export capabilities: %m\n"); goto ERROR; } @@ -1139,7 +1136,7 @@ FILE* pakfire_file_open(struct pakfire_file* file) { FILE* f = fopen(path, "r+"); if (!f) - ERROR(file->pakfire, "Could not open %s: %m\n", path); + CTX_ERROR(file->ctx, "Could not open %s: %m\n", path); return f; } @@ -1238,7 +1235,7 @@ static int pakfire_file_remove(struct pakfire_file* file) { const char* path = pakfire_file_get_path(file); const char* abspath = pakfire_file_get_abspath(file); - DEBUG(file->pakfire, "Removing %s...\n", path); + CTX_DEBUG(file->ctx, "Removing %s...\n", path); // We cannot delete if we don't have the absolute path if (!abspath) @@ -1267,7 +1264,7 @@ static int pakfire_file_remove(struct pakfire_file* file) { // Log anything else default: - ERROR(file->pakfire, "Could not remove directory %s: %m\n", path); + CTX_ERROR(file->ctx, "Could not remove directory %s: %m\n", path); break; } } @@ -1284,7 +1281,7 @@ static int pakfire_file_remove(struct pakfire_file* file) { break; default: - ERROR(file->pakfire, "Could not remove %s: %m\n", path); + CTX_ERROR(file->ctx, "Could not remove %s: %m\n", path); break; } } @@ -1331,12 +1328,12 @@ int pakfire_file_detect_mimetype(struct pakfire_file* file) { // Check the file const char* mimetype = magic_file(magic, path); if (!mimetype) { - ERROR(file->pakfire, "Could not classify %s: %s\n", + CTX_ERROR(file->ctx, "Could not classify %s: %s\n", pakfire_file_get_path(file), magic_error(magic)); return 1; } - DEBUG(file->pakfire, "Classified %s as %s\n", pakfire_file_get_path(file), mimetype); + CTX_DEBUG(file->ctx, "Classified %s as %s\n", pakfire_file_get_path(file), mimetype); // Store the value return pakfire_file_set_mimetype(file, mimetype); @@ -1360,10 +1357,10 @@ PAKFIRE_EXPORT int pakfire_file_set_mimetype( Classification */ -static int setup_libelf(struct pakfire* pakfire) { +static int setup_libelf(struct pakfire_ctx* ctx) { // Initialize libelf if (elf_version(EV_CURRENT) == EV_NONE) { - ERROR(pakfire, "Could not initialize libelf: %s\n", elf_errmsg(-1)); + CTX_ERROR(ctx, "Could not initialize libelf: %s\n", elf_errmsg(-1)); return 1; } @@ -1477,14 +1474,14 @@ static int pakfire_file_classify_elf(struct pakfire_file* file) { return 0; // Setup libelf - r = setup_libelf(file->pakfire); + r = setup_libelf(file->ctx); if (r) return r; // Open the file f = pakfire_file_open(file); if (!f) { - ERROR(file->pakfire, "Could not open %s: %m\n", pakfire_file_get_path(file)); + CTX_ERROR(file->ctx, "Could not open %s: %m\n", pakfire_file_get_path(file)); return 1; } @@ -1590,7 +1587,7 @@ int pakfire_file_cleanup(struct pakfire_file* file, int flags) { if (!*path) break; - DEBUG(file->pakfire, "Trying to remove parent directory %s\n", path); + CTX_DEBUG(file->ctx, "Trying to remove parent directory %s\n", path); r = rmdir(path); @@ -1610,7 +1607,7 @@ static int pakfire_file_verify_mode(struct pakfire_file* file, const struct stat if (type != (st->st_mode & S_IFMT)) { file->verify_status |= PAKFIRE_FILE_TYPE_CHANGED; - DEBUG(file->pakfire, "%s: File Type changed\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "%s: File Type changed\n", pakfire_file_get_path(file)); } const mode_t perms = pakfire_file_get_perms(file); @@ -1619,7 +1616,7 @@ static int pakfire_file_verify_mode(struct pakfire_file* file, const struct stat if (perms != (st->st_mode & 0777)) { file->verify_status |= PAKFIRE_FILE_PERMISSIONS_CHANGED; - DEBUG(file->pakfire, "%s: Permissions changed\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "%s: Permissions changed\n", pakfire_file_get_path(file)); } #if 0 @@ -1632,7 +1629,7 @@ static int pakfire_file_verify_mode(struct pakfire_file* file, const struct stat if (dev != st->st_dev) { file->verify_status |= PAKFIRE_FILE_DEV_CHANGED; - DEBUG(file->pakfire, "%s: Device Node changed\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "%s: Device Node changed\n", pakfire_file_get_path(file)); } } #endif @@ -1650,7 +1647,7 @@ static int pakfire_file_verify_size(struct pakfire_file* file, const struct stat // Size differs file->verify_status |= PAKFIRE_FILE_SIZE_CHANGED; - DEBUG(file->pakfire, "%s: Filesize differs (expected %zd, got %zd byte(s))\n", + CTX_DEBUG(file->ctx, "%s: Filesize differs (expected %zd, got %zd byte(s))\n", pakfire_file_get_path(file), size, st->st_size); return 0; @@ -1677,14 +1674,14 @@ static int pakfire_file_verify_ownership(struct pakfire_file* file, const struct if (!owner || owner->pw_uid != uid) { file->verify_status |= PAKFIRE_FILE_OWNER_CHANGED; - DEBUG(file->pakfire, "%s: Owner differs\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "%s: Owner differs\n", pakfire_file_get_path(file)); } // Check if group matches if (!group || group->gr_gid != gid) { file->verify_status |= PAKFIRE_FILE_GROUP_CHANGED; - DEBUG(file->pakfire, "%s: Group differs\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "%s: Group differs\n", pakfire_file_get_path(file)); } return 0; @@ -1698,14 +1695,14 @@ static int pakfire_file_verify_timestamps(struct pakfire_file* file, const struc if (ctime != st->st_ctime) { file->verify_status |= PAKFIRE_FILE_CTIME_CHANGED; - DEBUG(file->pakfire, "%s: Creation time changed\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "%s: Creation time changed\n", pakfire_file_get_path(file)); } // Check modification time if (mtime != st->st_mtime) { file->verify_status |= PAKFIRE_FILE_MTIME_CHANGED; - DEBUG(file->pakfire, "%s: Modification time changed\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "%s: Modification time changed\n", pakfire_file_get_path(file)); } return 0; @@ -1731,7 +1728,7 @@ static int pakfire_file_verify_payload(struct pakfire_file* file, const struct s digest_types = pakfire_digest_has_any(&file->digests); if (!digest_types) { - ERROR(file->pakfire, "%s: No digests available\n", pakfire_file_get_path(file)); + CTX_ERROR(file->ctx, "%s: No digests available\n", pakfire_file_get_path(file)); return 0; } @@ -1745,7 +1742,7 @@ static int pakfire_file_verify_payload(struct pakfire_file* file, const struct s if (r) { file->verify_status |= PAKFIRE_FILE_PAYLOAD_CHANGED; - DEBUG(file->pakfire, "%s: Digest(s) do not match\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "%s: Digest(s) do not match\n", pakfire_file_get_path(file)); } ERROR: @@ -1759,7 +1756,7 @@ int pakfire_file_verify(struct pakfire_file* file, int* status) { struct stat st; int r; - DEBUG(file->pakfire, "Verifying %s...\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "Verifying %s...\n", pakfire_file_get_path(file)); const char* abspath = pakfire_file_get_abspath(file); @@ -1831,21 +1828,21 @@ static int pakfire_file_open_elf(struct pakfire_file* file, } // Setup libelf - r = setup_libelf(file->pakfire); + r = setup_libelf(file->ctx); if (r) return r; // Open the file f = pakfire_file_open(file); if (!f) { - ERROR(file->pakfire, "Could not open %s: %m\n", pakfire_file_get_abspath(file)); + CTX_ERROR(file->ctx, "Could not open %s: %m\n", pakfire_file_get_abspath(file)); return 1; } // Parse the ELF header elf = elf_begin(fileno(f), ELF_C_READ, NULL); if (!elf) { - ERROR(file->pakfire, "Could not open ELF file: %s\n", elf_errmsg(-1)); + CTX_ERROR(file->ctx, "Could not open ELF file: %s\n", elf_errmsg(-1)); r = 1; goto ERROR; } @@ -1856,7 +1853,7 @@ static int pakfire_file_open_elf(struct pakfire_file* file, break; default: - ERROR(file->pakfire, "%s is not an ELF object\n", pakfire_file_get_path(file)); + CTX_ERROR(file->ctx, "%s is not an ELF object\n", pakfire_file_get_path(file)); r = 1; goto ERROR; } @@ -1953,7 +1950,7 @@ static int __pakfire_file_get_elf_type(struct pakfire_file* file, Elf* elf, void // Fetch the ELF header if (!gelf_getehdr(elf, &ehdr)) { - ERROR(file->pakfire, "Could not parse ELF header: %s\n", elf_errmsg(-1)); + CTX_ERROR(file->ctx, "Could not parse ELF header: %s\n", elf_errmsg(-1)); return 1; } @@ -1987,7 +1984,7 @@ static int pakfire_file_elf_dyn_walk(struct pakfire_file* file, Elf* elf, // Find the dynamic linking information r = pakfire_file_get_elf_section(file, elf, SHT_DYNAMIC, &dynamic, &shdr, &elf_data); if (r) { - DEBUG(file->pakfire, "%s does not have a dynamic section\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "%s does not have a dynamic section\n", pakfire_file_get_path(file)); return 0; } @@ -2015,7 +2012,7 @@ static int __pakfire_file_check_debuginfo(struct pakfire_file* file, Elf* elf, v // Not found if (r) { - DEBUG(file->pakfire, "%s has no debug sections\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "%s has no debug sections\n", pakfire_file_get_path(file)); // Store the result file->issues |= PAKFIRE_FILE_MISSING_DEBUGINFO; @@ -2050,7 +2047,7 @@ static int __pakfire_file_check_ssp( // Fetch the symbol table r = pakfire_file_get_elf_section(file, elf, SHT_SYMTAB, &symtab, &shdr, &elf_data); if (r) { - ERROR(file->pakfire, "%s has no symbol table\n", pakfire_file_get_path(file)); + CTX_ERROR(file->ctx, "%s has no symbol table\n", pakfire_file_get_path(file)); return 1; } @@ -2081,7 +2078,7 @@ static int __pakfire_file_check_ssp( // We do not perform the check for libraries that do not contain any functions. // Some packages use shared libraries to provide data. if (!counter) { - DEBUG(file->pakfire, "%s: File has no functions. Skipping SSP check.\n", + CTX_DEBUG(file->ctx, "%s: File has no functions. Skipping SSP check.\n", pakfire_file_get_path(file)); return 0; } @@ -2111,7 +2108,7 @@ static int pakfire_file_check_ssp(struct pakfire_file* file) { // Check if this file is whitelisted for (const char** path = whitelist; *path; path++) { if (pakfire_file_matches(file, *path)) { - DEBUG(file->pakfire, "Skipping SSP check for whitelisted file %s\n", + CTX_DEBUG(file->ctx, "Skipping SSP check for whitelisted file %s\n", pakfire_file_get_path(file)); return 0; } @@ -2145,7 +2142,7 @@ static int __pakfire_file_check_execstack( // Fetch the total numbers of program headers r = elf_getphdrnum(elf, &phnum); if (r) { - ERROR(file->pakfire, "Could not fetch number of program headers: %s\n", + CTX_ERROR(file->ctx, "Could not fetch number of program headers: %s\n", elf_errmsg(-1)); return 1; } @@ -2153,13 +2150,13 @@ static int __pakfire_file_check_execstack( // Walk through all program headers for (unsigned int i = 0; i < phnum; i++) { if (!gelf_getphdr(elf, i, &phdr)) { - ERROR(file->pakfire, "Could not parse program header: %s\n", elf_errmsg(-1)); + CTX_ERROR(file->ctx, "Could not parse program header: %s\n", elf_errmsg(-1)); return 1; } switch (phdr.p_type) { case PT_GNU_STACK: - DEBUG(file->pakfire, + CTX_DEBUG(file->ctx, "%s: GNU_STACK flags: %c%c%c\n", pakfire_file_get_path(file), (phdr.p_flags & PF_R) ? 'R' : '-', @@ -2274,7 +2271,7 @@ static int __pakfire_file_process_runpath(struct pakfire_file* file, if (!value) return 1; - DEBUG(file->pakfire, "%s has a RUNPATH: %s\n", + CTX_DEBUG(file->ctx, "%s has a RUNPATH: %s\n", pakfire_file_get_path(file), value); // Copy the value into a buffer we can modify @@ -2287,7 +2284,7 @@ static int __pakfire_file_process_runpath(struct pakfire_file* file, // Iterate over all elements while (runpath) { - ERROR(file->pakfire, "Checking RUNPATH %s\n", runpath); + CTX_ERROR(file->ctx, "Checking RUNPATH %s\n", runpath); // We do not allow any relative RUNPATHs if (pakfire_path_match(runpath, "**/../**")) @@ -2367,7 +2364,7 @@ static int pakfire_file_get_script_interpreter(struct pakfire_file* file, char** // Handle any reading errors if (bytes_read < 0) { - ERROR(file->pakfire, "Could not read from file %s: %m\n", + CTX_ERROR(file->ctx, "Could not read from file %s: %m\n", pakfire_file_get_path(file)); r = 1; goto ERROR; @@ -2380,12 +2377,12 @@ static int pakfire_file_get_script_interpreter(struct pakfire_file* file, char** } if (strncmp("#!", shebang, 2) == 0) { - DEBUG(file->pakfire, "%s is a script\n", pakfire_file_get_path(file)); + CTX_DEBUG(file->ctx, "%s is a script\n", pakfire_file_get_path(file)); // Find the end of the first line (to be able to perform string operations) p = memchr(shebang, '\n', sizeof(shebang)); if (!p) { - ERROR(file->pakfire, "%s: First line seems to be too long\n", + CTX_ERROR(file->ctx, "%s: First line seems to be too long\n", pakfire_file_get_path(file)); errno = ENOBUFS; r = 1; @@ -2443,12 +2440,12 @@ static int pakfire_file_fix_interpreter(struct pakfire_file* file, const char* i const char* path = pakfire_file_get_path(file); - DEBUG(file->pakfire, "%s: Fixing interpreter %s\n", path, interpreter); + CTX_DEBUG(file->ctx, "%s: Fixing interpreter %s\n", path, interpreter); // Open the file f = pakfire_file_open(file); if (!f) { - ERROR(file->pakfire, "Could not open %s: %m\n", path); + CTX_ERROR(file->ctx, "Could not open %s: %m\n", path); r = -errno; goto ERROR; } @@ -2460,7 +2457,7 @@ static int pakfire_file_fix_interpreter(struct pakfire_file* file, const char* i if (feof(f)) break; - ERROR(file->pakfire, "Could not read line from %s: %m\n", path); + CTX_ERROR(file->ctx, "Could not read line from %s: %m\n", path); goto ERROR; } @@ -2504,18 +2501,18 @@ static int pakfire_file_fix_interpreter(struct pakfire_file* file, const char* i if (*p) args = p; - DEBUG(file->pakfire, "%s: Found command %s (%s)\n", path, interpreter, args); + CTX_DEBUG(file->ctx, "%s: Found command %s (%s)\n", path, interpreter, args); // Find the real path r = pakfire_which(file->pakfire, command, interpreter); if (r) { - ERROR(file->pakfire, "%s: Could not resolve %s: %m\n", path, interpreter); + CTX_ERROR(file->ctx, "%s: Could not resolve %s: %m\n", path, interpreter); goto ERROR; } // If we could not resolve the command, this file has an invalid interpreter if (!*command) { - ERROR(file->pakfire, "%s: Could not find path for command %s\n", path, interpreter); + CTX_ERROR(file->ctx, "%s: Could not find path for command %s\n", path, interpreter); file->issues |= PAKFIRE_FILE_INVALID_INTERPRETER; r = 0; @@ -2564,7 +2561,7 @@ static int pakfire_file_fix_interpreter(struct pakfire_file* file, const char* i // Truncate the existing content r = ftruncate(fileno(f), 0); if (r) { - ERROR(file->pakfire, "Could not truncate %s: %m\n", path); + CTX_ERROR(file->ctx, "Could not truncate %s: %m\n", path); r = -errno; goto ERROR; } @@ -2573,7 +2570,7 @@ static int pakfire_file_fix_interpreter(struct pakfire_file* file, const char* i if (buffer) { size_t bytes_written = fwrite(buffer, 1, l, f); if (bytes_written < l) { - ERROR(file->pakfire, "%s: Could not write the payload: %m\n", path); + CTX_ERROR(file->ctx, "%s: Could not write the payload: %m\n", path); r = -errno; goto ERROR; } @@ -2606,7 +2603,7 @@ static int pakfire_file_check_interpreter(struct pakfire_file* file) { if (!interpreter) return 0; - DEBUG(file->pakfire, "%s: Interpreter: %s\n", + CTX_DEBUG(file->ctx, "%s: Interpreter: %s\n", pakfire_file_get_path(file), interpreter); // Paths must be absolute @@ -2621,7 +2618,7 @@ static int pakfire_file_check_interpreter(struct pakfire_file* file) { else if (strcmp(interpreter, "/usr/bin/env") == 0) { r = pakfire_file_fix_interpreter(file, interpreter); if (r) { - ERROR(file->pakfire, "%s: Could not fix interpreter: %m\n", + CTX_ERROR(file->ctx, "%s: Could not fix interpreter: %m\n", pakfire_file_get_path(file)); goto ERROR; } @@ -2681,7 +2678,7 @@ static int __pakfire_file_check_cf_protection_x86(struct pakfire_file* file, // Check for IBT if (!(property & GNU_PROPERTY_X86_FEATURE_1_IBT)) { - DEBUG(file->pakfire, "%s: IBT property is not enabled\n", + CTX_DEBUG(file->ctx, "%s: IBT property is not enabled\n", pakfire_file_get_path(file)); // XXX TODO Actually modify any flags @@ -2691,7 +2688,7 @@ static int __pakfire_file_check_cf_protection_x86(struct pakfire_file* file, // Check for Shadow Stack if (!(property & GNU_PROPERTY_X86_FEATURE_1_SHSTK)) { - DEBUG(file->pakfire, "%s: Shadow Stack is not enabled\n", + CTX_DEBUG(file->ctx, "%s: Shadow Stack is not enabled\n", pakfire_file_get_path(file)); // XXX TODO Actually modify any flags @@ -2719,7 +2716,7 @@ static int pakfire_file_check_cf_protection_callback(struct pakfire_file* file, // Fetch the ELF header if (!gelf_getehdr(elf, &ehdr)) { - ERROR(file->pakfire, "Could not fetch the ELF header for %s: %m\n", + CTX_ERROR(file->ctx, "Could not fetch the ELF header for %s: %m\n", pakfire_file_get_path(file)); return 1; } @@ -2730,7 +2727,7 @@ static int pakfire_file_check_cf_protection_callback(struct pakfire_file* file, // Fetch the .note header offset = gelf_getnote(data, offset, &nhdr, &offset_name, &offset_data); if (!offset) { - ERROR(file->pakfire, "Could not read note section: %m\n"); + CTX_ERROR(file->ctx, "Could not read note section: %m\n"); return 1; } @@ -2767,7 +2764,7 @@ static int pakfire_file_check_cf_protection_callback(struct pakfire_file* file, payload += sizeof(type) + sizeof(size); if (length < size) { - ERROR(file->pakfire, "GNU Property note has an incorrect format\n"); + CTX_ERROR(file->ctx, "GNU Property note has an incorrect format\n"); return 1; } @@ -2785,7 +2782,7 @@ static int pakfire_file_check_cf_protection_callback(struct pakfire_file* file, break; default: - ERROR(file->pakfire, "Unsupported ELF type (%d)\n", ehdr.e_machine); + CTX_ERROR(file->ctx, "Unsupported ELF type (%d)\n", ehdr.e_machine); return 1; }