Do not produce empty cat file in debug mode

This commit is contained in:
Andrey A. Chernov 1996-06-22 08:05:11 +00:00
parent 372fa2cd81
commit 55c148f316

View File

@ -1131,7 +1131,9 @@ make_cat_file (path, man_file, cat_file)
}
}
if (rename(temp, cat_file) == -1) {
if (debug)
unlink(temp);
else if (rename(temp, cat_file) == -1) {
s = errno;
fprintf(stderr,
"\nHmm! Can't seem to rename %s to %s, check permissions on man dir!\n",
@ -1147,13 +1149,19 @@ make_cat_file (path, man_file, cat_file)
if (fclose(fp)) {
s = errno;
unlink(cat_file);
if (!debug)
unlink(cat_file);
fprintf(stderr, "Failed.\n");
errno = s;
perror("fclose");
return 0;
}
if (debug) {
fprintf(stderr, "No output, debug mode.\n");
return 0;
}
fprintf(stderr, "Done.\n");
return 1;