summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2019-10-12 17:21:57 +0200
committerMarcus Meissner <marcus@jet.franken.de>2019-10-12 17:21:57 +0200
commitd0628bdbd9c4a21de0e4f3e05bd9b015517d0afb (patch)
tree002d60f0aa53cb751aa65c694ea3ca1bdac358a3
parent14f558f1351b7b099a850e0800e0ae9e5f13cb87 (diff)
downloadlibgphoto2-d0628bdbd9c4a21de0e4f3e05bd9b015517d0afb.tar.gz
free also the files in the root folder on gp_filesystem_reset
fixes https://github.com/gphoto/libgphoto2/issues/425
-rw-r--r--libgphoto2/gphoto2-filesys.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libgphoto2/gphoto2-filesys.c b/libgphoto2/gphoto2-filesys.c
index 52874a8ee..8726e9def 100644
--- a/libgphoto2/gphoto2-filesys.c
+++ b/libgphoto2/gphoto2-filesys.c
@@ -633,6 +633,10 @@ gp_filesystem_reset (CameraFilesystem *fs)
GP_LOG_D ("resetting filesystem");
CR (gp_filesystem_lru_clear (fs));
CR (delete_all_folders (fs, "/", NULL));
+
+ /* the recurse delete will not delete the files in /, only in subdirs */
+ delete_all_files (fs, fs->rootfolder);
+
if (fs->rootfolder) {
fs->rootfolder->files_dirty = 1;
fs->rootfolder->folders_dirty = 1;