Throw an exception if we cannot create a temp/backup file name.

committer: mfx <mfx> 976591585 +0000
This commit is contained in:
Markus F.X.J. Oberhumer
2000-12-12 03:26:25 +00:00
parent c3b4fd723f
commit 1efd7f5cfa
+6 -2
View File
@@ -111,7 +111,10 @@ void do_one_file(const char *iname, char *oname)
if (opt->output_name) if (opt->output_name)
strcpy(tname,opt->output_name); strcpy(tname,opt->output_name);
else else
maketempname(tname,iname,".upx"); {
if (!maketempname(tname,iname,".upx"))
throwIOException("could not create a temporary file name");
}
if (opt->force >= 2) if (opt->force >= 2)
{ {
#if defined(HAVE_CHMOD) #if defined(HAVE_CHMOD)
@@ -188,7 +191,8 @@ void do_one_file(const char *iname, char *oname)
{ {
// make backup // make backup
char bakname[PATH_MAX+1]; char bakname[PATH_MAX+1];
makebakname(bakname,iname); if (!makebakname(bakname,iname))
throwIOException("could not create a backup file name");
File::rename(iname,bakname); File::rename(iname,bakname);
} }
File::rename(oname,iname); File::rename(oname,iname);