1
0
mirror of https://gittea.dev/nova/th.git synced 2025-12-09 09:10:10 -05:00

handling of '/' in thread_lft

This commit is contained in:
nova
2025-11-15 22:21:30 +01:00
parent 1e99e9d364
commit 9a67b35ebe

View File

@@ -122,17 +122,24 @@ void *thread_lft(){
char *path = malloc(strlen(global_path)+1);
memcpy(path, global_path, strlen(global_path)+1);
path[strrchr(path, '/')-path] = '\0';
path[0] = '/';
if (strcmp(path, "/") != 0) {
path[strrchr(path, '/')-path+1] = '\0';
path[strrchr(path, '/')-path] = '\0';
path[0] = '/';
if (local_status & STATUS_RELOAD_DIRECTORY) {
lft_file_count = get_dir_size(path);
free(lft_content);
lft_content = malloc(lft_file_count * sizeof(file));
memset(lft_content, '\0', lft_file_count * sizeof(file));
get_dir_content(path, &lft_file_count, lft_content);
if (local_status & STATUS_RELOAD_DIRECTORY) {
lft_file_count = get_dir_size(path);
free(lft_content);
lft_content = malloc(lft_file_count * sizeof(file));
memset(lft_content, '\0', lft_file_count * sizeof(file));
get_dir_content(path, &lft_file_count, lft_content);
}
} else {
lft_file_count = 0;
}
free(path);
}
pthread_mutex_unlock(&mutex_lft);