diff --git a/src/arch/ArchHooks/ArchHooks_Unix.cpp b/src/arch/ArchHooks/ArchHooks_Unix.cpp index ce2e1dfd72..3463f29997 100644 --- a/src/arch/ArchHooks/ArchHooks_Unix.cpp +++ b/src/arch/ArchHooks/ArchHooks_Unix.cpp @@ -386,16 +386,6 @@ RString ArchHooks_Unix::GetClipboard() static LocalizedString COULDNT_FIND_SONGS( "ArchHooks_Unix", "Couldn't find 'Songs'" ); void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable ) { -#if defined(UNIX) - /* Mount the root filesystem, so we can read files in /proc, /etc, and so on. - * This is /rootfs, not /root, to avoid confusion with root's home directory. */ - FILEMAN->Mount( "dir", "/", "/rootfs" ); - - /* Mount /proc, so Alsa9Buf::GetSoundCardDebugInfo() and others can access it. - * (Deprecated; use rootfs.) */ - FILEMAN->Mount( "dir", "/proc", "/proc" ); -#endif - RString Root; struct stat st; if( !stat(sDirOfExecutable + "/Packages", &st) && st.st_mode&S_IFDIR ) diff --git a/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp b/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp index 08c1ea5a02..ddee48fbe7 100644 --- a/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp +++ b/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp @@ -2,7 +2,6 @@ #include "MemoryCardDriverThreaded_Linux.h" #include "RageLog.h" #include "RageUtil.h" -#include "RageFile.h" #include "RageTimer.h" #include @@ -14,8 +13,11 @@ #include #endif +#include +#include #include #include +#include #include #include @@ -286,29 +288,31 @@ void MemoryCardDriverThreaded_Linux::GetUSBStorageDevices( vectorWarn( "can't open '%s': %s", fn.c_str(), f.GetError().c_str() ); + LOG->Warn( "can't open '/etc/fstab': %s", strerror(errno) ); return; } - - RString sLine; - while( !f.AtEOF() ) + + std::string line; + while( !f.eof() ) { - switch( f.GetLine(sLine) ) + std::getline(f, line); + if (f.eof()) { - case 0: continue; /* eof */ - case -1: - LOG->Warn( "error reading '%s': %s", fn.c_str(), f.GetError().c_str() ); + continue; + } + else if (f.fail()) + { + LOG->Warn( "error reading '/etc/fstab': %s", strerror(errno) ); return; } char szScsiDevice[1024]; char szMountPoint[1024]; - int iRet = sscanf( sLine, "%s %s", szScsiDevice, szMountPoint ); + int iRet = sscanf( line.c_str(), "%s %s", szScsiDevice, szMountPoint ); if( iRet != 2 || szScsiDevice[0] == '#') continue; // don't process this line diff --git a/src/arch/Sound/ALSA9Dynamic.cpp b/src/arch/Sound/ALSA9Dynamic.cpp index 12b83a6452..40c68cd43c 100644 --- a/src/arch/Sound/ALSA9Dynamic.cpp +++ b/src/arch/Sound/ALSA9Dynamic.cpp @@ -1,6 +1,7 @@ #include "global.h" #include +#include #define ALSA_PCM_NEW_HW_PARAMS_API #define ALSA_PCM_NEW_SW_PARAMS_API @@ -28,7 +29,8 @@ RString LoadALSA() * on use, and this would prevent that from happening. I don't know if anyone actually * does that, though: they're often configured to load snd (the core module) if ALSA * devices are accessed, but hardware drivers are typically loaded on boot. */ - if( !IsADirectory("/rootfs/proc/asound/") ) + struct stat st; + if (stat("/proc/asound/", &st) == -1 || !(st.st_mode & S_IFDIR)) return "/proc/asound/ does not exist"; ASSERT( Handle == nullptr ); diff --git a/src/arch/Sound/ALSA9Helpers.cpp b/src/arch/Sound/ALSA9Helpers.cpp index 4199e81427..3a390b5908 100644 --- a/src/arch/Sound/ALSA9Helpers.cpp +++ b/src/arch/Sound/ALSA9Helpers.cpp @@ -5,6 +5,9 @@ #include "ALSA9Dynamic.h" #include "PrefsManager.h" +#include +#include + /* int err; must be defined before using this macro */ #define ALSA_CHECK(x) \ if ( err < 0 ) { LOG->Info("ALSA: %s: %s", x, dsnd_strerror(err)); return false; } @@ -140,11 +143,12 @@ void Alsa9Buf::GetSoundCardDebugInfo() return; done = true; - if( DoesFileExist("/rootfs/proc/asound/version") ) + std::ifstream f("/proc/asound/version"); + if (f.good()) { - RString sVersion; - GetFileContents( "/rootfs/proc/asound/version", sVersion, true ); - LOG->Info( "ALSA: %s", sVersion.c_str() ); + std::string version; + std::getline(f, version); + LOG->Info( "ALSA: %s", version.c_str() ); } InitializeErrorHandler(); diff --git a/src/arch/Sound/RageSoundDriver_OSS.cpp b/src/arch/Sound/RageSoundDriver_OSS.cpp index 6828de3e94..d37f76cd4a 100644 --- a/src/arch/Sound/RageSoundDriver_OSS.cpp +++ b/src/arch/Sound/RageSoundDriver_OSS.cpp @@ -4,7 +4,6 @@ #include "RageLog.h" #include "RageSound.h" #include "RageSoundManager.h" -#include "RageUtil.h" #if defined(HAVE_UNISTD_H) #include @@ -17,6 +16,7 @@ #include #include #include +#include REGISTER_SOUND_DRIVER_CLASS( OSS ); @@ -138,7 +138,8 @@ RString RageSoundDriver_OSS::CheckOSSVersion( int fd ) */ #ifndef FORCE_OSS #define ALSA_SNDRV_OSS_VERSION ((3<<16)|(8<<8)|(1<<4)|(0)) - if( version == ALSA_SNDRV_OSS_VERSION && IsADirectory("/rootfs/proc/asound") ) + struct stat st; + if( version == ALSA_SNDRV_OSS_VERSION && stat("/proc/asound", &st) && (st.st_mode & S_IFDIR) ) return "RageSoundDriver_OSS: ALSA detected. ALSA OSS emulation is buggy; use ALSA natively."; #endif if( version )