summaryrefslogtreecommitdiff
path: root/converters/ru-d1489/patches/patch-aa
blob: b262a0a79530e66d11ec8375b63af51325ff0307 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$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;
 		}