diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-10-17 17:25:38 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-10-17 18:38:49 -0400 |
commit | 6f9a157fcac76466df8834eb73e04d7127e78b52 (patch) | |
tree | a40ab1aa102fae0c70feeed9b6f44c78d711d947 /firmware/target/hosted/filesystem-app.c | |
parent | f3ec58c05b1f0044240cf5e95ff28e6966398958 (diff) | |
download | rockbox-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.c | 20 |
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 |