This commit is contained in:
adolski 2022-11-01 05:42:36 +09:00 committed by GitHub
commit c2663e5742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -70,6 +70,8 @@
#ifdef OPJ_HAVE_LIBLCMS2
#include <lcms2.h>
#include <sys/stat.h>
#endif
#ifdef OPJ_HAVE_LIBLCMS1
#include <lcms.h>
@ -1816,7 +1818,15 @@ int main(int argc, char **argv)
/* destroy the codestream index */
opj_destroy_cstr_index(&cstr_index);
if (failed) {
/* delete the destination file, if it's a regular file */
struct stat info;
int retval = lstat(parameters.outfile, &info);
int file = 1;
if (retval >= 0) {
file = S_ISREG(info.st_mode);
}
if (failed && file != 0) {
(void)remove(parameters.outfile); /* ignore return value */
}
}