check file name not empty on return from uncomp exec

This commit is contained in:
dockes 2007-02-19 18:05:25 +00:00
parent 0ea2a92575
commit 3ee8979ee7

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.27 2007-02-08 17:05:12 dockes Exp $ (C) 2004 J.F.Dockes"; static char rcsid[] = "@(#$Id: internfile.cpp,v 1.28 2007-02-19 18:05:25 dockes Exp $ (C) 2004 J.F.Dockes";
#endif #endif
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -88,12 +88,12 @@ static bool uncompressfile(RclConfig *conf, const string& ifn,
// Execute command and retrieve output file name, check that it exists // Execute command and retrieve output file name, check that it exists
ExecCmd ex; ExecCmd ex;
int status = ex.doexec(cmd, args, 0, &tfile); int status = ex.doexec(cmd, args, 0, &tfile);
if (status) { if (status || tfile.empty()) {
LOGERR(("uncompressfile: doexec: status 0x%x\n", status)); LOGERR(("uncompressfile: doexec: status 0x%x\n", status));
rmdir(tdir.c_str()); rmdir(tdir.c_str());
return false; return false;
} }
if (!tfile.empty() && tfile[tfile.length() - 1] == '\n') if (tfile[tfile.length() - 1] == '\n')
tfile.erase(tfile.length() - 1, 1); tfile.erase(tfile.length() - 1, 1);
return true; return true;
} }