]>
Commit | Line | Data |
---|---|---|
911d5a92 JB |
1 | --- pinfo-0.6.0/src/manual.c.mkstemp Wed Aug 2 14:14:21 2000 |
2 | +++ pinfo-0.6.0/src/manual.c Wed Aug 2 14:25:11 2000 | |
3 | @@ -168,13 +168,18 @@ | |
4 | size_t macroline_size; | |
5 | int ignored_items = 0, i = 0; | |
6 | char zipped = 0; | |
7 | + char tempbuf[PATH_MAX] = "/tmp/pinfoXXXXXX"; | |
8 | + int fd; | |
9 | ||
10 | if (tmpfilename1) | |
11 | { | |
12 | unlink (tmpfilename1); | |
13 | xfree (tmpfilename1); | |
14 | } | |
15 | - tmpfilename1 = tempnam ("/tmp", NULL); | |
16 | + fd = mkstemp(tempbuf); | |
17 | + fchmod(fd, S_IRUSR | S_IWUSR); | |
18 | + close(fd); | |
19 | + tmpfilename1 = strdup(tempbuf); | |
20 | ||
21 | #ifdef getmaxyx | |
22 | init_curses (); | |
23 | @@ -199,6 +204,8 @@ | |
24 | if (ignoredmacros) /* if the pointer is non-null */ | |
25 | if (*ignoredmacros && strlen (ignoredmacros)) /* if there are some macros */ | |
26 | { /* that should be ignored */ | |
27 | + char tempbuf[PATH_MAX] = "/tmp/pinfoXXXXXX"; | |
28 | + int fd; | |
29 | *location = '\0'; | |
30 | snprintf (cmd, 255, "man -W %s %s", /* we need to know the path */ | |
31 | ManOptions, | |
32 | @@ -268,9 +275,11 @@ | |
33 | } | |
34 | else | |
35 | source = fopen (location, "r"); /* from cmd output */ | |
36 | - name = tempnam ("/tmp", NULL); | |
37 | + fd = mkstemp(tempbuf); | |
38 | + fchmod(fd, S_IRUSR | S_IWUSR); | |
39 | + name = strdup(tempbuf); | |
40 | raw_tempfilename = name; | |
41 | - id = fopen (name, "w"); | |
42 | + id = fdopen (fd, "w"); | |
43 | ||
44 | while (!feof (source)) /* we read until eof */ | |
45 | { | |
46 | @@ -370,12 +379,17 @@ | |
47 | manual_aftersearch = 0; | |
48 | if (return_value != -1) /* -1 is quit key */ | |
49 | { | |
50 | + char tempbuf[PATH_MAX] = "/tmp/pinfoXXXXXX"; | |
51 | + int fd; | |
52 | if (tmpfilename2) | |
53 | { | |
54 | unlink (tmpfilename2); | |
55 | xfree (tmpfilename2); | |
56 | } | |
57 | - tmpfilename2 = tempnam ("/tmp", NULL); | |
58 | + fd = mkstemp(tempbuf); | |
59 | + fchmod(fd, S_IRUSR | S_IWUSR); | |
60 | + close(fd); | |
61 | + tmpfilename2 = strdup(tempbuf); | |
62 | if (return_value != -2) /* key_back is not pressed; | |
63 | and return_value is an | |
64 | offset to manuallinks */ | |
65 | --- pinfo-0.6.0/src/filehandling_functions.c.mkstemp Wed Aug 2 14:14:26 2000 | |
66 | +++ pinfo-0.6.0/src/filehandling_functions.c Wed Aug 2 14:25:42 2000 | |
67 | @@ -452,12 +452,17 @@ | |
68 | ||
69 | if (number == 0) /* initialize tmp filename for file 1 */ | |
70 | { | |
71 | + char tmpbuf[PATH_MAX] = "/tmp/pinfoXXXXXX"; | |
72 | + int fd; | |
73 | if (tmpfilename1) | |
74 | { | |
75 | unlink (tmpfilename1); /* erase old tmpfile */ | |
76 | free (tmpfilename1); | |
77 | } | |
78 | - tmpfilename1 = tempnam ("/tmp", NULL); | |
79 | + fd = mkstemp(tmpbuf); | |
80 | + fchmod(fd, S_IRUSR | S_IWUSR); | |
81 | + close(fd); | |
82 | + tmpfilename1 = strdup(tmpbuf); | |
83 | tmpfilename = tmpfilename1; /* later we will refere only to tmp1 */ | |
84 | } | |
85 | for (i = 0; i < infopathcount; i++) /* go through all paths */ | |
86 | @@ -601,23 +606,33 @@ | |
87 | ||
88 | if (number == 0) /* initialize tmp filename for file 1 */ | |
89 | { | |
90 | + char tmpbuf[PATH_MAX] = "/tmp/pinfoXXXXXX"; | |
91 | + int fd; | |
92 | if (tmpfilename1) | |
93 | { | |
94 | unlink (tmpfilename1); /* erase old tmpfile */ | |
95 | free (tmpfilename1); | |
96 | } | |
97 | - tmpfilename1 = tempnam ("/tmp", NULL); | |
98 | + fd = mkstemp(tmpbuf); | |
99 | + fchmod(fd, S_IRUSR | S_IWUSR); | |
100 | + close(fd); | |
101 | + tmpfilename1 = strdup(tmpbuf); | |
102 | tmpfilename = tmpfilename1; /* later we will refere only to tmp1 */ | |
103 | } | |
104 | else | |
105 | /* initialize tmp filename for file 2 */ | |
106 | { | |
107 | + char tmpbuf[PATH_MAX] = "/tmp/pinfoXXXXXX"; | |
108 | + int fd; | |
109 | if (tmpfilename2) | |
110 | { | |
111 | unlink (tmpfilename2); /* erase old tmpfile */ | |
112 | free (tmpfilename2); | |
113 | } | |
114 | - tmpfilename2 = tempnam ("/tmp", NULL); | |
115 | + fd = mkstemp(tmpbuf); | |
116 | + fchmod(fd, S_IRUSR | S_IWUSR); | |
117 | + close(fd); | |
118 | + tmpfilename2 = strdup(tmpbuf); | |
119 | tmpfilename = tmpfilename2; /* later we will refere only to tmp2 */ | |
120 | } | |
121 | ||
122 | --- pinfo-0.6.0/src/common_includes.h.mkstemp Wed Aug 2 14:22:04 2000 | |
123 | +++ pinfo-0.6.0/src/common_includes.h Wed Aug 2 14:22:15 2000 | |
124 | @@ -14,6 +14,7 @@ | |
125 | #include <stdlib.h> | |
126 | #include <signal.h> | |
127 | #include <unistd.h> | |
128 | +#include <limits.h> | |
129 | #include <sys/types.h> | |
130 | #include <sys/stat.h> | |
131 | #include <pwd.h> |