$NetBSD: patch-aa,v 1.1.1.1 2002/07/12 21:01:17 agc Exp $ --- todos.c Tue Dec 22 01:50:00 1998 +++ todos.nb.c Sun Jun 23 17:02:54 2002 @@ -97,6 +97,7 @@ main(int ac, char **av) { char *name, *tmpn, *srcn, *s, *incode, *outcode; + int tmpfd; FILE *fin, *fout; struct stat statb; int got_stat = FALSE; @@ -251,10 +252,11 @@ } sprintf(tmp_name, "%s%s%s", outdir, *outdir ? "/" : "", tmp_pat); - if ((tmpn = mktemp(tmp_name)) == NULL) { + if ((tmpfd = mkstemp(tmp_name)) < 0) { perror(tmp_name); return 1; } + strcpy(tmpn, tmp_name); while (ac-- > 1) { srcn = av[1]; @@ -267,7 +269,7 @@ perror(srcn); goto usage; } - if ((fout = fopen(tmpn, WB)) == NULL) { + if ((fout = fdopen(tmpfd, WB)) == NULL) { perror(tmpn); return 1; }