mirror of
https://gittea.dev/nova/th.git
synced 2025-12-11 02:00:10 -05:00
handling of '/' in thread_lft
This commit is contained in:
@@ -122,6 +122,8 @@ 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);
|
||||||
|
|
||||||
|
if (strcmp(path, "/") != 0) {
|
||||||
|
path[strrchr(path, '/')-path+1] = '\0';
|
||||||
path[strrchr(path, '/')-path] = '\0';
|
path[strrchr(path, '/')-path] = '\0';
|
||||||
path[0] = '/';
|
path[0] = '/';
|
||||||
|
|
||||||
@@ -133,6 +135,11 @@ void *thread_lft(){
|
|||||||
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