summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.c1
-rw-r--r--term_tag.c9
-rw-r--r--term_tag.h2
3 files changed, 7 insertions, 5 deletions
diff --git a/main.c b/main.c
index 12fe6928..db2ed168 100644
--- a/main.c
+++ b/main.c
@@ -846,6 +846,7 @@ process_onefile(struct mparse *mp, struct manpage *resp, int startdir,
if (outst->use_pager) {
outst->use_pager = 0;
outst->tag_files = term_tag_init(conf->output.outfilename,
+ outst->outtype == OUTT_HTML ? ".html" : "",
conf->output.tagfilename);
#if HAVE_PLEDGE
if ((conf->output.outfilename != NULL ||
diff --git a/term_tag.c b/term_tag.c
index 968f88a0..0272ecff 100644
--- a/term_tag.c
+++ b/term_tag.c
@@ -47,7 +47,8 @@ static struct tag_files tag_files;
* but for simplicity, create it anyway.
*/
struct tag_files *
-term_tag_init(const char *outfilename, const char *tagfilename)
+term_tag_init(const char *outfilename, const char *suffix,
+ const char *tagfilename)
{
struct sigaction sa;
int ofd; /* In /tmp/, dup(2)ed to stdout. */
@@ -85,9 +86,9 @@ term_tag_init(const char *outfilename, const char *tagfilename)
/* Create both temporary output files. */
if (outfilename == NULL) {
- (void)strlcpy(tag_files.ofn, "/tmp/man.XXXXXXXXXX",
- sizeof(tag_files.ofn));
- if ((ofd = mkstemp(tag_files.ofn)) == -1) {
+ (void)snprintf(tag_files.ofn, sizeof(tag_files.ofn),
+ "/tmp/man.XXXXXXXXXX%s", suffix);
+ if ((ofd = mkstemps(tag_files.ofn, strlen(suffix))) == -1) {
mandoc_msg(MANDOCERR_MKSTEMP, 0, 0,
"%s: %s", tag_files.ofn, strerror(errno));
goto fail;
diff --git a/term_tag.h b/term_tag.h
index 7009d4c4..c0fbc320 100644
--- a/term_tag.h
+++ b/term_tag.h
@@ -28,7 +28,7 @@ struct tag_files {
};
-struct tag_files *term_tag_init(const char *, const char *);
+struct tag_files *term_tag_init(const char *, const char *, const char *);
void term_tag_write(struct roff_node *, size_t);
int term_tag_close(void);
void term_tag_unlink(void);