summaryrefslogtreecommitdiff
path: root/src/linux
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-09 15:41:43 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-09 15:41:43 +0100
commit703c9ff2ea607d457b1d8c6ff4022b6869d40bf7 (patch)
treea847fa3a0ea023eb97ac46131fd6ba4c1a291c13 /src/linux
parent331882200dbad630d7722b4f05e23d69edbc6a6a (diff)
fix warnings
Diffstat (limited to 'src/linux')
-rw-r--r--src/linux/main_linux.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/linux/main_linux.cpp b/src/linux/main_linux.cpp
index fda8d64..2041c09 100644
--- a/src/linux/main_linux.cpp
+++ b/src/linux/main_linux.cpp
@@ -32,7 +32,7 @@ static const char* _ts_platform_get_config_file_path(char* buffer) {
char* env = getenv("HOME");
char path_buf[MAX_INPUT_LENGTH];
snprintf(path_buf, MAX_INPUT_LENGTH, "%s%s", env, "/text-search/");
- snprintf(buffer, MAX_INPUT_LENGTH, "%s%s", path_buf, "imgui.ini");
+ snprintf(buffer, MAX_INPUT_LENGTH, "%.*s%s", MAX_INPUT_LENGTH-10, path_buf, "imgui.ini");
if (!ts_platform_dir_exists(path_buf)) {
mkdir(path_buf, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
}
@@ -232,10 +232,10 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir)
struct dirent *dir;
d = opendir(search_dir);
if (d) {
- chdir(search_dir);
+ if (chdir(search_dir) != 0) return;
while ((dir = readdir(d)) != NULL) {
if (result->cancel_search) return;
- chdir(search_dir);
+ if (chdir(search_dir) != 0) continue;
if (dir->d_type == DT_DIR)
{
@@ -254,7 +254,7 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir)
else if (dir->d_type == DT_REG || dir->d_type == DT_UNKNOWN)
{
char *matched_filter = 0;
- if (ts_filter_matches(&result->filters, dir->d_name, &matched_filter) == -1) {
+ if (ts_filter_matches(&result->filters, dir->d_name, &matched_filter) == (size_t)-1) {
continue;
}
(void)matched_filter;