From 5d7dc3755731dbbddb6f9196ee7987b1ac029db7 Mon Sep 17 00:00:00 2001 From: leo-arch Date: Mon, 23 Dec 2024 11:04:28 -0300 Subject: [PATCH] Silence a few flawfinder warnings --- src/aux.c | 2 +- src/colors.c | 2 +- src/config.c | 4 ++-- src/file_operations.c | 4 ++-- src/main.c | 2 +- src/misc.c | 4 ++-- src/tabcomp.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/aux.c b/src/aux.c index fdb3a564..43ee227a 100644 --- a/src/aux.c +++ b/src/aux.c @@ -687,7 +687,7 @@ xmkdir(const char *dir, const mode_t mode) { mode_t old_mask = umask(0077); /* flawfinder: ignore */ int ret = mkdirat(XAT_FDCWD, dir, mode); - umask(old_mask); + umask(old_mask); /* flawfinder: ignore */ if (ret == -1) return FUNC_FAILURE; diff --git a/src/colors.c b/src/colors.c index 97f6a554..77d84ac5 100644 --- a/src/colors.c +++ b/src/colors.c @@ -1033,7 +1033,7 @@ import_color_scheme(const char *name) char *cmd[] = {"cp", "--", dfile, colors_dir, NULL}; const mode_t old_mask = umask(0077); /* flawfinder: ignore */ const int ret = launch_execv(cmd, FOREGROUND, E_NOFLAG); - umask(old_mask); + umask(old_mask); /* flawfinder: ignore */ return ret == FUNC_SUCCESS ? ret : FUNC_FAILURE; } diff --git a/src/config.c b/src/config.c index 4db37247..27ba7e43 100644 --- a/src/config.c +++ b/src/config.c @@ -854,7 +854,7 @@ import_from_data_dir(const char *src_filename, char *dest, const int exec) const mode_t old_umask = umask(exec == 1 ? 0077 : 0177); /* flawfinder: ignore */ char *cmd[] = {"cp", "--", sys_file, dest, NULL}; const int ret = launch_execv(cmd, FOREGROUND, E_NOSTDERR); - umask(old_umask); + umask(old_umask); /* flawfinder: ignore */ if (ret == FUNC_SUCCESS) { #ifndef __MSYS__ @@ -3591,7 +3591,7 @@ read_config(void) ret = sscanf(line + 6, "%o\n", &opt_num); if (ret == -1 || opt_num > MAX_UMASK) continue; - umask((mode_t)opt_num); + umask((mode_t)opt_num); /* flawfinder: ignore */ } else if (xargs.welcome_message == UNSET && *line == 'W' diff --git a/src/file_operations.c b/src/file_operations.c index 0ea940ab..01b14023 100644 --- a/src/file_operations.c +++ b/src/file_operations.c @@ -103,7 +103,7 @@ umask_function(char *arg) /* umask is set to zero, and then changed back, only to get the * current value. */ printf("%04o\n", old_umask); - umask(old_umask); + umask(old_umask); /* flawfinder: ignore */ return FUNC_SUCCESS; } @@ -119,7 +119,7 @@ umask_function(char *arg) if (new_umask < 0 || new_umask > MAX_UMASK) goto ERROR; - umask((mode_t)new_umask); + umask((mode_t)new_umask); /* flawfinder: ignore */ printf(_("File-creation mask set to '%04o'\n"), new_umask); return FUNC_SUCCESS; diff --git a/src/main.c b/src/main.c index ee9fbb1d..ed4038a7 100644 --- a/src/main.c +++ b/src/main.c @@ -1420,7 +1420,7 @@ main(int argc, char *argv[]) init_workspaces_opts(); /* Restore user umask */ - umask(old_mask); + umask(old_mask); /* flawfinder: ignore */ /* # 2. MAIN PROGRAM LOOP # */ run_main_loop(); diff --git a/src/misc.c b/src/misc.c index 96902de1..a81a3e7c 100644 --- a/src/misc.c +++ b/src/misc.c @@ -361,7 +361,7 @@ read_inotify(void) char inotify_buf[EVENT_BUF_LEN]; memset((void *)inotify_buf, '\0', sizeof(inotify_buf)); - i = (int)read(inotify_fd, inotify_buf, sizeof(inotify_buf)); + i = (int)read(inotify_fd, inotify_buf, sizeof(inotify_buf)); /* flawfinder: ignore */ if (i <= 0) { # ifdef INOTIFY_DEBUG @@ -1887,7 +1887,7 @@ handle_stdin(void) char *buf = xnmalloc(chunk, sizeof(char)); while (chunks_n < max_chunks) { - input_len = read(STDIN_FILENO, buf + total_len, chunk); + input_len = read(STDIN_FILENO, buf + total_len, chunk); /* flawfinder: ignore */ /* Error */ if (input_len < 0) { diff --git a/src/tabcomp.c b/src/tabcomp.c index a61aeddc..0db4baee 100644 --- a/src/tabcomp.c +++ b/src/tabcomp.c @@ -852,7 +852,7 @@ ctrl-d:deselect-all,ctrl-t:toggle-all" : "", flags &= ~DELAYED_REFRESH; const mode_t old_mask = umask(0077); /* flawfinder: ignore */ const int ret = launch_execl(cmd); - umask(old_mask); + umask(old_mask); /* flawfinder: ignore */ if (restore_cwd == 1) xchdir(workspaces[cur_ws].path, NO_TITLE);