diff options
author | Dave Davenport <qball@gmpclient.org> | 2023-03-27 11:52:27 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2023-03-27 11:52:27 +0200 |
commit | 3446e88cb88f0e1cad39fea3f0194b87d77e6de9 (patch) | |
tree | 66ba3d2087eb85443f3e4f8f84a432a69120c669 | |
parent | ebae594c087a10f378cb597c1a9387f80bb30155 (diff) |
Remove unneeded test and extra enforcement of 0 terminated buffer
-rwxr-xr-x | doc/meson_build_manpages.sh | 2 | ||||
-rw-r--r-- | source/helper.c | 3 | ||||
-rw-r--r-- | source/rofi.c | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/doc/meson_build_manpages.sh b/doc/meson_build_manpages.sh index ef0adfb6..eaea2cc1 100755 --- a/doc/meson_build_manpages.sh +++ b/doc/meson_build_manpages.sh @@ -8,5 +8,5 @@ pushd "${MESON_BUILD_ROOT}" for a in $@ do - go-md2man -in $a -out ${a%.markdown} + go-md2man -in "$a" -out ${a%.markdown} done diff --git a/source/helper.c b/source/helper.c index ad6541a8..267e06ca 100644 --- a/source/helper.c +++ b/source/helper.c @@ -582,8 +582,9 @@ int create_pid_file(const char *pidfile, gboolean kill_running) { char buffer[64] = { 0, }; - ssize_t l = read(fd, &buffer, 64); + ssize_t l = read(fd, &buffer, 63); if (l > 1) { + buffer[l] = 0; pid_t pid = g_ascii_strtoll(buffer, NULL, 0); kill(pid, SIGTERM); while (1) { diff --git a/source/rofi.c b/source/rofi.c index 9dd4697e..aa9c686b 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1074,7 +1074,7 @@ int main(int argc, char *argv[]) { */ const char **theme_str = find_arg_strv("-theme-str"); if (theme_str) { - for (int index = 0; theme_str && theme_str[index]; index++) { + for (int index = 0; theme_str[index]; index++) { if (rofi_theme_parse_string(theme_str[index])) { g_warning("Failed to parse -theme-str option: \"%s\"", theme_str[index]); |