MemoryCardDriver: parse fstab comments

Also silences some unneeded warnings.
This commit is contained in:
Devin J. Pohly
2013-09-05 15:34:25 -04:00
parent 1ef4c16bb5
commit 9309ee09e9
@@ -46,6 +46,8 @@ static bool ReadFile( const RString &sPath, RString &sBuf )
int fd = open( sPath, O_RDONLY ); int fd = open( sPath, O_RDONLY );
if( fd == -1 ) if( fd == -1 )
{ {
// "No such file or directory" is understandable
if (errno != ENOENT)
LOG->Warn( "Error opening \"%s\": %s", sPath.c_str(), strerror(errno) ); LOG->Warn( "Error opening \"%s\": %s", sPath.c_str(), strerror(errno) );
return false; return false;
} }
@@ -301,7 +303,7 @@ void MemoryCardDriverThreaded_Linux::GetUSBStorageDevices( vector<UsbStorageDevi
char szScsiDevice[1024]; char szScsiDevice[1024];
char szMountPoint[1024]; char szMountPoint[1024];
int iRet = sscanf( sLine, "%s %s", szScsiDevice, szMountPoint ); int iRet = sscanf( sLine, "%s %s", szScsiDevice, szMountPoint );
if( iRet != 2 ) if( iRet != 2 || szScsiDevice[0] == '#')
continue; // don't process this line continue; // don't process this line
/* Get the real kernel device name, which should match /* Get the real kernel device name, which should match
@@ -311,6 +313,8 @@ void MemoryCardDriverThreaded_Linux::GetUSBStorageDevices( vector<UsbStorageDevi
char szUnderlyingDevice[PATH_MAX]; char szUnderlyingDevice[PATH_MAX];
if( realpath(szScsiDevice, szUnderlyingDevice) == NULL ) if( realpath(szScsiDevice, szUnderlyingDevice) == NULL )
{ {
// "No such file or directory" is understandable
if (errno != ENOENT)
LOG->Warn( "realpath(\"%s\"): %s", szScsiDevice, strerror(errno) ); LOG->Warn( "realpath(\"%s\"): %s", szScsiDevice, strerror(errno) );
continue; continue;
} }