better error output

This commit is contained in:
Glenn Maynard
2004-03-15 03:43:43 +00:00
parent 7fb89b6f7a
commit ed17ae0d3e
@@ -5,6 +5,7 @@
#include "RageFileManager.h" #include "RageFileManager.h"
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
@@ -40,7 +41,7 @@ bool MemoryCardDriver_Linux::StorageDevicesChanged()
struct stat st; struct stat st;
if( fstat(m_fds, &st) == -1 ) if( fstat(m_fds, &st) == -1 )
{ {
LOG->Warn( "stat of '%s' failed.", USB_DEVICE_LIST_FILE ); LOG->Warn( "stat '%s' failed: %s", USB_DEVICE_LIST_FILE, strerror(errno) );
return false; return false;
} }
@@ -191,16 +192,15 @@ void MemoryCardDriver_Linux::GetStorageDevices( vector<UsbStorageDevice>& vDevic
// /dev/sdc1 /mnt/flash3 auto noauto,owner 0 0 // /dev/sdc1 /mnt/flash3 auto noauto,owner 0 0
CString fn = "/etc/fstab"; CString fn = "/etc/fstab";
ifstream f; RageFile f;
f.open(fn); if( !f.Open(fn) )
if( !f.is_open() )
{ {
LOG->Warn( "can't open '%s'", fn.c_str() ); LOG->Warn( "can't open '%s': %s", fn.c_str(), f.GetError().c_str() );
return; return;
} }
CString sLine; CString sLine;
while( getline(f, sLine) ) while( f.GetLine(sLine) )
{ {
// /dev/sda1 /mnt/flash1 auto noauto,owner 0 0 // /dev/sda1 /mnt/flash1 auto noauto,owner 0 0
char cScsiDev; char cScsiDev;