diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-10-17 15:57:07 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-10-17 17:10:52 -0400 |
commit | 012908e0641f0581ee2d0515596db287ee5edf4c (patch) | |
tree | ff64817ab09dc99fc2bcf0e51c27a0f4b55ed948 /firmware | |
parent | a68fc3b6c2eca281738b853bb2f508ac49ddfee1 (diff) | |
download | rockbox-012908e064.tar.gz rockbox-012908e064.zip |
hosted: Fix HAVE_MULTIDRIVE to work properly with PIVOT_ROOT
Change-Id: Ibc97de5c345e88c19ad8ba8c05fefebbada08790
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/config/samsungypr0.h | 2 | ||||
-rw-r--r-- | firmware/target/hosted/filesystem-app.c | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/firmware/export/config/samsungypr0.h b/firmware/export/config/samsungypr0.h index 655ed811b7..286299bf81 100644 --- a/firmware/export/config/samsungypr0.h +++ b/firmware/export/config/samsungypr0.h @@ -164,7 +164,7 @@ /* External SD card can be mounted */ #define CONFIG_STORAGE (STORAGE_HOSTFS|STORAGE_SD) -#define HAVE_MULTIDRIVE +#define HAVE_MULTIDRIVE /* But _not_ CONFIG_STORAGE_MULTI */ #define NUM_DRIVES 2 #define HAVE_HOTSWAP #define HAVE_STORAGE_FLUSH diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c index 16ad5e312f..93057e7a83 100644 --- a/firmware/target/hosted/filesystem-app.c +++ b/firmware/target/hosted/filesystem-app.c @@ -8,6 +8,7 @@ * $Id$ * * Copyright (C) 2010 Thomas Martitz + * Copyright (C) 2020 Solomon Peachy * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -53,8 +54,10 @@ static const char rbhome[] = "/sdcard"; #elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) \ && !defined(__PCTOOL__) static const char *rbhome; +#elif defined(PIVOT_ROOT) +static const char rbhome[] = PIVOT_ROOT; #else -/* YPR0, YPR1, NWZ, etc */ +/* Anything else? */ static const char rbhome[] = HOME_DIR; #endif #endif @@ -94,9 +97,7 @@ static const char *handle_special_links(const char* link, unsigned flags, return link; } -#endif -#ifdef HAVE_MULTIDRIVE /* 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) @@ -209,12 +210,19 @@ const char * handle_special_dirs(const char *dir, unsigned flags, dir = _get_user_file_path(dir, flags, buf, bufsize); #endif #ifdef HAVE_MULTIDRIVE +#define MULTIDRIVE_DIR_LEN (sizeof(MULTIDRIVE_DIR)-1) + dir = handle_special_links(dir, flags, buf, bufsize); #endif #ifdef PIVOT_ROOT #define PIVOT_ROOT_LEN (sizeof(PIVOT_ROOT)-1) /* Prepend root prefix to find actual path */ - if (strncmp(PIVOT_ROOT, dir, PIVOT_ROOT_LEN)) + if (strncmp(PIVOT_ROOT, dir, PIVOT_ROOT_LEN) +#ifdef MULTIDRIVE_DIR + /* Unless it's a MULTIDRIVE dir, in which case use as-is */ + && strncmp(MULTIDRIVE_DIR, dir, MULTIDRIVE_DIR_LEN) +#endif + ) { snprintf(buf, bufsize, "%s/%s", PIVOT_ROOT, dir); dir = buf; |