From 0c884029fc4e1084c4b2d7b9ed6241884bf41739 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Mon, 30 Jun 2025 09:28:39 -0300 Subject: [PATCH] procevent.c: reposition some debug message calls Move them from the middle of the finalization code to before it. --- src/firemon/procevent.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/firemon/procevent.c b/src/firemon/procevent.c index 7c3ca7bd0..91835cb11 100644 --- a/src/firemon/procevent.c +++ b/src/firemon/procevent.c @@ -70,10 +70,10 @@ static int pid_is_firejail(pid_t pid) { if (asprintf(&fname, "/proc/%d/cmdline", pid) == -1) errExit("asprintf"); if ((fd = open(fname, O_RDONLY)) < 0) { - free(fname); #ifdef DEBUG_PRCTL printf("%s: %d, comm %s, rv %d\n", __FUNCTION__, __LINE__, buf, rv); #endif + free(fname); goto doexit; } free(fname); @@ -83,10 +83,10 @@ static int pid_is_firejail(pid_t pid) { unsigned char buffer[BUFLEN]; ssize_t len; if ((len = read(fd, buffer, sizeof(buffer) - 1)) <= 0) { - close(fd); #ifdef DEBUG_PRCTL printf("%s: %d, comm %s, rv %d\n", __FUNCTION__, __LINE__, buf, rv); #endif + close(fd); goto doexit; } buffer[len] = '\0'; @@ -136,10 +136,10 @@ static int pid_is_firejail(pid_t pid) { int j = 0; while (exclude_args[j] != NULL) { if (strcmp(start, exclude_args[j]) == 0) { - rv = 0; #ifdef DEBUG_PRCTL printf("start=#%s#, ptr=#%s#, flip rv %d\n", start, ptr, rv); #endif + rv = 0; break; } j++; @@ -150,11 +150,11 @@ printf("start=#%s#, ptr=#%s#, flip rv %d\n", start, ptr, rv); } doexit: - fclose(fp); - free(file); #ifdef DEBUG_PRCTL printf("%s: %d, return %d\n", __FUNCTION__, __LINE__, rv); #endif + fclose(fp); + free(file); return rv; }