summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/cdromutl.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2011-05-16 15:57:52 +0200
committerMichael Vogt <mvo@debian.org>2011-05-16 15:57:52 +0200
commitd44b706c2d5964daaaf55e6eb97845827958f6e3 (patch)
treeb77f6e72c34c2444ec28e2d47430211d802efb4b /apt-pkg/contrib/cdromutl.cc
parent9c192d2811c12dcaf607024eb7f0677b011194e6 (diff)
parentd77b985a309c379d4978525172a72b728fecd15e (diff)
merged from lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg/contrib/cdromutl.cc')
-rw-r--r--apt-pkg/contrib/cdromutl.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc
index 83c324f54..821e6d688 100644
--- a/apt-pkg/contrib/cdromutl.cc
+++ b/apt-pkg/contrib/cdromutl.cc
@@ -20,7 +20,6 @@
#include <apti18n.h>
#include <sys/wait.h>
-#include <sys/errno.h>
#include <sys/statvfs.h>
#include <dirent.h>
#include <fcntl.h>
@@ -206,8 +205,11 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version)
Hash.Add(Dir->d_name);
};
- if (chdir(StartDir.c_str()) != 0)
- return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str());
+ if (chdir(StartDir.c_str()) != 0) {
+ _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str());
+ closedir(D);
+ return false;
+ }
closedir(D);
// Some stats from the fsys
@@ -236,7 +238,7 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version)
}
/*}}}*/
-// FindMountPointForDevice - Find mountpoint for the given device /*{{{*/
+// FindMountPointForDevice - Find mountpoint for the given device /*{{{*/
string FindMountPointForDevice(const char *devnode)
{
char buf[255];
@@ -254,7 +256,10 @@ string FindMountPointForDevice(const char *devnode)
while ( fgets(buf, sizeof(buf), f) != NULL) {
if (strncmp(buf, devnode, strlen(devnode)) == 0) {
if(TokSplitString(' ', buf, out, 10))
+ {
+ fclose(f);
return string(out[1]);
+ }
}
}
fclose(f);
@@ -263,5 +268,4 @@ string FindMountPointForDevice(const char *devnode)
return string();
}
-
-
+ /*}}}*/