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:
23
threading.c
23
threading.c
@@ -122,17 +122,24 @@ void *thread_lft(){
|
|||||||
char *path = malloc(strlen(global_path)+1);
|
char *path = malloc(strlen(global_path)+1);
|
||||||
memcpy(path, global_path, strlen(global_path)+1);
|
memcpy(path, global_path, strlen(global_path)+1);
|
||||||
|
|
||||||
path[strrchr(path, '/')-path] = '\0';
|
if (strcmp(path, "/") != 0) {
|
||||||
path[0] = '/';
|
path[strrchr(path, '/')-path+1] = '\0';
|
||||||
|
path[strrchr(path, '/')-path] = '\0';
|
||||||
|
path[0] = '/';
|
||||||
|
|
||||||
if (local_status & STATUS_RELOAD_DIRECTORY) {
|
if (local_status & STATUS_RELOAD_DIRECTORY) {
|
||||||
lft_file_count = get_dir_size(path);
|
lft_file_count = get_dir_size(path);
|
||||||
free(lft_content);
|
free(lft_content);
|
||||||
lft_content = malloc(lft_file_count * sizeof(file));
|
lft_content = malloc(lft_file_count * sizeof(file));
|
||||||
memset(lft_content, '\0', lft_file_count * sizeof(file));
|
memset(lft_content, '\0', lft_file_count * sizeof(file));
|
||||||
get_dir_content(path, &lft_file_count, lft_content);
|
get_dir_content(path, &lft_file_count, lft_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
lft_file_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
free(path);
|
free(path);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&mutex_lft);
|
pthread_mutex_unlock(&mutex_lft);
|
||||||
|
|||||||
Reference in New Issue
Block a user