summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/filesystem-app.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-17 17:25:38 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-17 18:38:49 -0400
commit6f9a157fcac76466df8834eb73e04d7127e78b52 (patch)
treea40ab1aa102fae0c70feeed9b6f44c78d711d947 /firmware/target/hosted/filesystem-app.c
parentf3ec58c05b1f0044240cf5e95ff28e6966398958 (diff)
downloadrockbox-6f9a157fca.tar.gz
rockbox-6f9a157fca.tar.bz2
rockbox-6f9a157fca.zip
hosted: Fix USB mounting code to work with HAVE_MULTIDRIVE enabled
Change-Id: I48944c28903db117d3d883a5e777cafe5d055600
Diffstat (limited to 'firmware/target/hosted/filesystem-app.c')
-rw-r--r--firmware/target/hosted/filesystem-app.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c
index 93057e7a83..2121af7752 100644
--- a/firmware/target/hosted/filesystem-app.c
+++ b/firmware/target/hosted/filesystem-app.c
@@ -100,11 +100,20 @@ static const char *handle_special_links(const char* link, unsigned flags,
/* we keep an open descriptor of the home directory to detect when it has been
opened by opendir() so that its "symlinks" may be enumerated */
-static void cleanup_rbhome(void)
+void cleanup_rbhome(void)
{
os_close(rbhome_fildes);
rbhome_fildes = -1;
}
+void startup_rbhome(void)
+{
+ /* if this fails then alternate volumes will not work, but this function
+ cannot return that fact */
+ rbhome_fildes = os_opendirfd(rbhome);
+ if (rbhome_fildes >= 0)
+ atexit(cleanup_rbhome);
+}
+
#endif /* HAVE_MULTIDRIVE */
void paths_init(void)
@@ -140,14 +149,9 @@ void paths_init(void)
os_mkdir(config_dir __MKDIR_MODE_ARG);
#endif
#endif /* HAVE_SPECIAL_DIRS */
-
#ifdef HAVE_MULTIDRIVE
- /* if this fails then alternate volumes will not work, but this function
- cannot return that fact */
- rbhome_fildes = os_opendirfd(rbhome);
- if (rbhome_fildes >= 0)
- atexit(cleanup_rbhome);
-#endif /* HAVE_MULTIDRIVE */
+ startup_rbhome();
+#endif
}
#ifdef HAVE_SPECIAL_DIRS