From 9623bcd575d22649718feec5bdde10e17ada59e4 Mon Sep 17 00:00:00 2001 From: John Johansen Date: Mon, 1 Jun 2020 02:21:19 -0700 Subject: [PATCH] libapparmor: Fix build of features.c when debug is enabled PDEBUG is defined away when debug isn't configure in the build, this hides the bad format string and argument. Fix this and make sure we can still have the debug output that was supposed to be printed. MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/561 Signed-off-by: John Johansen Acked-by: Steve Beattie --- libraries/libapparmor/src/features.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/libapparmor/src/features.c b/libraries/libapparmor/src/features.c index 64be077ec..d81c81205 100644 --- a/libraries/libapparmor/src/features.c +++ b/libraries/libapparmor/src/features.c @@ -136,7 +136,7 @@ static ssize_t load_features_file(int file, char *buffer, size_t size) if (len > 0) errno = ENOBUFS; - PDEBUG("Error reading features file '%s': %m\n", path); + PDEBUG("Error reading features file: %m\n"); return -1; } @@ -162,6 +162,7 @@ static ssize_t open_and_load_features_file(int dirfd, const char *path, char *buffer, size_t size) { autoclose int file = -1; + ssize_t rc; file = openat(dirfd, path, O_RDONLY); if (file < 0) { @@ -175,7 +176,10 @@ static ssize_t open_and_load_features_file(int dirfd, const char *path, return -1; } - return load_features_file(file, buffer, size); + rc = load_features_file(file, buffer, size); + if (rc == -1) + PDEBUG("Error failed to load features file '%s': %m\n", path); + return rc; } static int features_dir_cb(int dirfd, const char *name, struct stat *st,