update: use g_file_test() instead of stat()
If we want to check whether a file is a directory, use GLib's g_file_test() instead of stat().
This commit is contained in:
parent
38e3220fd4
commit
b2e3b64483
@ -192,11 +192,10 @@ removeDeletedFromDirectory(char *path_max_tmp, struct directory *directory)
|
|||||||
|
|
||||||
for (i = dv->nr; --i >= 0; ) {
|
for (i = dv->nr; --i >= 0; ) {
|
||||||
const char *path_fs;
|
const char *path_fs;
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
path_fs = map_directory_fs(dv->base[i], path_max_tmp);
|
path_fs = map_directory_fs(dv->base[i], path_max_tmp);
|
||||||
if (path_fs == NULL || (stat(path_fs, &st) == 0 &&
|
if (path_fs == NULL ||
|
||||||
S_ISDIR(st.st_mode)))
|
!g_file_test(path_fs, G_FILE_TEST_IS_DIR))
|
||||||
continue;
|
continue;
|
||||||
g_debug("removing directory: %s", dv->base[i]->path);
|
g_debug("removing directory: %s", dv->base[i]->path);
|
||||||
dirvec_delete(dv, dv->base[i]);
|
dirvec_delete(dv, dv->base[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user