ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/paths.c
(Generate patch)

Comparing ray/src/common/paths.c (file contents):
Revision 2.2 by schorsch, Thu Jun 26 00:58:09 2003 UTC vs.
Revision 2.3 by schorsch, Mon Jun 30 14:59:11 2003 UTC

# Line 104 | Line 104 | append_filepath(char *s1, char *s2, size_t len)
104   static char *
105   prepare_tmpname(char *s, size_t len, char *templ)
106   {
107 <        static char lp[PATH_MAX] = "\0"; /* remember what we found last time */
107 >        static char lp[PATH_MAX] = "\0";
108          char *ts = NULL;
109  
110          if (s == NULL) { /* return our static string */
# Line 143 | Line 143 | temp_filename(char *s, size_t len, char *templ)
143   /* WARNING: On Windows, there's a maximum of 27 unique names within
144              one process for the same template. */
145   int
146 < temp_file(char *s, size_t len, char *templ)
146 > temp_fd(char *s, size_t len, char *templ)
147   {
148          char *ts = NULL;
149  
# Line 152 | Line 152 | temp_file(char *s, size_t len, char *templ)
152   #ifdef _WIN32
153          ts = mktemp(ts);
154          if (ts == NULL) return -1;
155 <        return fopen(ts, "r+b"); /* XXX des "b" need to be an option? */
155 >        return open(ts, O_CREAT|O_EXCL, S_IRUSR|S_IWUSR);
156   #else
157          return mkstemp(ts);
158   #endif
159 + }
160 +
161 + /* As above, but returns a file pointer instead of a descriptor */
162 + FILE *
163 + temp_fp(char *s, size_t len, char *templ)
164 + {
165 +        int fd = temp_file(s, len, templ);
166 +        if (fd < 0) return NULL;
167 +        return fdopen(fd, "w+");
168   }
169  
170  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines