Add better checking and error messages.

This commit is contained in:
Steve Checkoway
2003-11-07 09:59:29 +00:00
parent e986f15792
commit 5657cc859f
2 changed files with 13 additions and 4 deletions
+11 -4
View File
@@ -43,6 +43,9 @@ mError(Processor::DefaultError), mInstalling(i)
if (mInstalling)
{
if (!DoesFileExist(path))
throw CString("Archive file not present.");
char archivePath[] = "/tmp/installerXXXXXX.tar";
int fd = mkstemps(archivePath, 4);
@@ -52,12 +55,16 @@ mError(Processor::DefaultError), mInstalling(i)
mPath = archivePath;
char toolPath[] = "/usr/bin/gunzip";
if(CallTool2(true, -1, fd, -1, toolPath, "-c", path.c_str(), NULL))
{
try {
if(CallTool2(true, -1, fd, -1, toolPath, "-c", path.c_str(), NULL))
throw CString("Archive file not handled correctly.");
} catch (CString& e) {
close(fd);
unlink(mPath);
throw CString("Archive file not handled correctly or not present.");
throw;
}
close(fd);
}
else
mPath = path;