Mercurial > noffle
comparison src/content.c @ 196:60a70c16d79c noffle
[svn] * src/content.c: When generating temp file to write new content to, make
sure there is no possibility of a name clash with an existing file.
Bug spotted by Mirko Liss.
author | bears |
---|---|
date | Tue, 30 Oct 2001 13:55:53 +0000 |
parents | f1bacee93ca6 |
children | 24d4cd032da5 |
comparison
equal
deleted
inserted
replaced
195:76460d98b2fb | 196:60a70c16d79c |
---|---|
1 /* | 1 /* |
2 content.c | 2 content.c |
3 | 3 |
4 $Id: content.c 307 2001-09-12 20:33:44Z bears $ | 4 $Id: content.c 315 2001-10-30 13:55:53Z bears $ |
5 */ | 5 */ |
6 | 6 |
7 #if HAVE_CONFIG_H | 7 #if HAVE_CONFIG_H |
8 #include <config.h> | 8 #include <config.h> |
9 #endif | 9 #endif |
164 extendCont( numb - cont.first + 1 ); | 164 extendCont( numb - cont.first + 1 ); |
165 cont.elem[ numb - cont.first ] = ov; | 165 cont.elem[ numb - cont.first ] = ov; |
166 } | 166 } |
167 fclose( f ); | 167 fclose( f ); |
168 | 168 |
169 | |
169 if ( cont.first == 0 ) | 170 if ( cont.first == 0 ) |
170 setupEmpty( name ); /* Corrupt overview file recovery */ | 171 setupEmpty( name ); /* Corrupt overview file recovery */ |
171 else | 172 else |
172 { | 173 { |
173 int grpLast; | 174 int grpLast; |
195 /* If nowt has changed, do nowt. */ | 196 /* If nowt has changed, do nowt. */ |
196 if ( ! cont.dirty ) | 197 if ( ! cont.dirty ) |
197 return; | 198 return; |
198 | 199 |
199 /* Save the overview to temporary file in same dir. */ | 200 /* Save the overview to temporary file in same dir. */ |
200 snprintf( tmpfname, MAXCHAR, "%s/overview/%s.%d", | 201 snprintf( tmpfname, MAXCHAR, "%s/overview/.#%d.%s", |
201 Cfg_spoolDir(), cont.name, (int) getpid() ); | 202 Cfg_spoolDir(), (int) getpid(), cont.name ); |
202 if ( ! ( f = fopen( tmpfname, "w" ) ) ) | 203 if ( ! ( f = fopen( tmpfname, "w" ) ) ) |
203 { | 204 { |
204 Log_err( "Could not open %s for writing", tmpfname ); | 205 Log_err( "Could not open %s for writing", tmpfname ); |
205 return; | 206 return; |
206 } | 207 } |