From d81bbdf8f0e38eea30f0462616f64538d74770f5 Mon Sep 17 00:00:00 2001 From: anbr Date: Sun, 26 Dec 2010 20:24:33 +0100 Subject: Improve read of volume name --- commands.c | 4 +++- volname.c | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/commands.c b/commands.c index 05a5e66..b4e08f0 100644 --- a/commands.c +++ b/commands.c @@ -729,8 +729,10 @@ cCMDImageRead::cCMDImageRead(cImageList &imagelist) } else { + dsyslog("dvdswitch: query name of volume %s",DVDSwitchSetup.DVDLinkOrg); int err = volname(DVDSwitchSetup.DVDLinkOrg, File,sizeof(File)); if(0 != err) { + esyslog("dvdswitch: Can't query name of volume! %d", err); OSDErrorNumMsg(err, tr("Can't query name of volume!")); strcpy(File, "\0"); } @@ -898,7 +900,7 @@ void cCMDImageReadThread::Action(void) if(f) { struct mntent *m; while ((m = getmntent(f))) { - dsyslog("%s %s %s", m->mnt_fsname, m->mnt_dir, m->mnt_type); + //dsyslog("%s %s %s", m->mnt_fsname, m->mnt_dir, m->mnt_type); if( m && m->mnt_fsname && m->mnt_dir && (0 == strcmp(m->mnt_fsname, DVDSwitchSetup.DVDLinkOrg) || 0 == strcmp(m->mnt_fsname, buffer))) { diff --git a/volname.c b/volname.c index a8de754..de1405a 100644 --- a/volname.c +++ b/volname.c @@ -18,6 +18,7 @@ #include #include #include +#include int volname(const char* device, char* volname, size_t volsize) { @@ -25,6 +26,8 @@ int volname(const char* device, char* volname, size_t volsize) int status; char buffer[PATH_MAX]; + bzero(volname,volsize); + if(!realpath(device, buffer)) { return errno; } @@ -49,5 +52,8 @@ int volname(const char* device, char* volname, size_t volsize) } close(fd); + + stripspace(volname); + return 0; } -- cgit v1.2.3