Fossil SCM
This branch contains experimental changes attempting to address complaints that Fossil sometimes overwrites unmanaged files. In this checkin: Use file_delete() instead of unlink() everywhere. Add interfaces file_move() and file_dont_overwrite() but do not use those interfaces yet.
Commit
a1814d501565aeea9d5cbbdb5a8fb78a90150be6
Parent
e7b6434112be8a0…
15 files changed
+3
-3
+3
-3
+2
-2
+1
-1
+1
-1
+3
-3
+44
-1
+2
-2
+1
-1
+2
-2
+2
-2
+1
-1
+2
-2
+1
-1
+3
-3
+3
-3
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -351,19 +351,19 @@ | ||
| 351 | 351 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 352 | 352 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 353 | 353 | } |
| 354 | 354 | while( db_step(&q)==SQLITE_ROW ){ |
| 355 | 355 | if( allFlag ){ |
| 356 | - unlink(db_column_text(&q, 0)); | |
| 356 | + file_delete(db_column_text(&q, 0)); | |
| 357 | 357 | }else{ |
| 358 | 358 | Blob ans; |
| 359 | 359 | char *prompt = mprintf("remove unmanaged file \"%s\" (y/N)? ", |
| 360 | 360 | db_column_text(&q, 0)); |
| 361 | 361 | blob_zero(&ans); |
| 362 | 362 | prompt_user(prompt, &ans); |
| 363 | 363 | if( blob_str(&ans)[0]=='y' ){ |
| 364 | - unlink(db_column_text(&q, 0)); | |
| 364 | + file_delete(db_column_text(&q, 0)); | |
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | db_finalize(&q); |
| 369 | 369 | } |
| @@ -458,11 +458,11 @@ | ||
| 458 | 458 | if( zIn[0]=='.' && (zIn[1]==0 || zIn[1]=='\r' || zIn[1]=='\n') ) break; |
| 459 | 459 | blob_append(&text, zIn, -1); |
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | blob_remove_cr(&text); |
| 463 | - unlink(zFile); | |
| 463 | + file_delete(zFile); | |
| 464 | 464 | free(zFile); |
| 465 | 465 | blob_zero(pComment); |
| 466 | 466 | while( blob_line(&text, &line) ){ |
| 467 | 467 | int i, n; |
| 468 | 468 | char *z; |
| 469 | 469 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -351,19 +351,19 @@ | |
| 351 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 352 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 353 | } |
| 354 | while( db_step(&q)==SQLITE_ROW ){ |
| 355 | if( allFlag ){ |
| 356 | unlink(db_column_text(&q, 0)); |
| 357 | }else{ |
| 358 | Blob ans; |
| 359 | char *prompt = mprintf("remove unmanaged file \"%s\" (y/N)? ", |
| 360 | db_column_text(&q, 0)); |
| 361 | blob_zero(&ans); |
| 362 | prompt_user(prompt, &ans); |
| 363 | if( blob_str(&ans)[0]=='y' ){ |
| 364 | unlink(db_column_text(&q, 0)); |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | db_finalize(&q); |
| 369 | } |
| @@ -458,11 +458,11 @@ | |
| 458 | if( zIn[0]=='.' && (zIn[1]==0 || zIn[1]=='\r' || zIn[1]=='\n') ) break; |
| 459 | blob_append(&text, zIn, -1); |
| 460 | } |
| 461 | } |
| 462 | blob_remove_cr(&text); |
| 463 | unlink(zFile); |
| 464 | free(zFile); |
| 465 | blob_zero(pComment); |
| 466 | while( blob_line(&text, &line) ){ |
| 467 | int i, n; |
| 468 | char *z; |
| 469 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -351,19 +351,19 @@ | |
| 351 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 352 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 353 | } |
| 354 | while( db_step(&q)==SQLITE_ROW ){ |
| 355 | if( allFlag ){ |
| 356 | file_delete(db_column_text(&q, 0)); |
| 357 | }else{ |
| 358 | Blob ans; |
| 359 | char *prompt = mprintf("remove unmanaged file \"%s\" (y/N)? ", |
| 360 | db_column_text(&q, 0)); |
| 361 | blob_zero(&ans); |
| 362 | prompt_user(prompt, &ans); |
| 363 | if( blob_str(&ans)[0]=='y' ){ |
| 364 | file_delete(db_column_text(&q, 0)); |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | db_finalize(&q); |
| 369 | } |
| @@ -458,11 +458,11 @@ | |
| 458 | if( zIn[0]=='.' && (zIn[1]==0 || zIn[1]=='\r' || zIn[1]=='\n') ) break; |
| 459 | blob_append(&text, zIn, -1); |
| 460 | } |
| 461 | } |
| 462 | blob_remove_cr(&text); |
| 463 | file_delete(zFile); |
| 464 | free(zFile); |
| 465 | blob_zero(pComment); |
| 466 | while( blob_line(&text, &line) ){ |
| 467 | int i, n; |
| 468 | char *z; |
| 469 |
+3
-3
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -157,16 +157,16 @@ | ||
| 157 | 157 | free(zManFile); |
| 158 | 158 | blob_reset(&hash); |
| 159 | 159 | }else{ |
| 160 | 160 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){ |
| 161 | 161 | zManFile = mprintf("%smanifest", g.zLocalRoot); |
| 162 | - unlink(zManFile); | |
| 162 | + file_delete(zManFile); | |
| 163 | 163 | free(zManFile); |
| 164 | 164 | } |
| 165 | 165 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){ |
| 166 | 166 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 167 | - unlink(zManFile); | |
| 167 | + file_delete(zManFile); | |
| 168 | 168 | free(zManFile); |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | } |
| @@ -268,11 +268,11 @@ | ||
| 268 | 268 | int i; |
| 269 | 269 | for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){ |
| 270 | 270 | if( manifestOnly==0 || zReserved[0]=='m' ){ |
| 271 | 271 | char *z; |
| 272 | 272 | z = mprintf("%s%s", g.zLocalRoot, zReserved); |
| 273 | - unlink(z); | |
| 273 | + file_delete(z); | |
| 274 | 274 | free(z); |
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -157,16 +157,16 @@ | |
| 157 | free(zManFile); |
| 158 | blob_reset(&hash); |
| 159 | }else{ |
| 160 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){ |
| 161 | zManFile = mprintf("%smanifest", g.zLocalRoot); |
| 162 | unlink(zManFile); |
| 163 | free(zManFile); |
| 164 | } |
| 165 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){ |
| 166 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 167 | unlink(zManFile); |
| 168 | free(zManFile); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | } |
| @@ -268,11 +268,11 @@ | |
| 268 | int i; |
| 269 | for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){ |
| 270 | if( manifestOnly==0 || zReserved[0]=='m' ){ |
| 271 | char *z; |
| 272 | z = mprintf("%s%s", g.zLocalRoot, zReserved); |
| 273 | unlink(z); |
| 274 | free(z); |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | |
| 279 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -157,16 +157,16 @@ | |
| 157 | free(zManFile); |
| 158 | blob_reset(&hash); |
| 159 | }else{ |
| 160 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){ |
| 161 | zManFile = mprintf("%smanifest", g.zLocalRoot); |
| 162 | file_delete(zManFile); |
| 163 | free(zManFile); |
| 164 | } |
| 165 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){ |
| 166 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 167 | file_delete(zManFile); |
| 168 | free(zManFile); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | } |
| @@ -268,11 +268,11 @@ | |
| 268 | int i; |
| 269 | for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){ |
| 270 | if( manifestOnly==0 || zReserved[0]=='m' ){ |
| 271 | char *z; |
| 272 | z = mprintf("%s%s", g.zLocalRoot, zReserved); |
| 273 | file_delete(z); |
| 274 | free(z); |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | |
| 279 |
+2
-2
| --- src/clearsign.c | ||
| +++ src/clearsign.c | ||
| @@ -52,11 +52,11 @@ | ||
| 52 | 52 | }else{ |
| 53 | 53 | if( pOut!=pIn ){ |
| 54 | 54 | blob_copy(pOut, pIn); |
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | - unlink(zOut); | |
| 58 | - unlink(zIn); | |
| 57 | + file_delete(zOut); | |
| 58 | + file_delete(zIn); | |
| 59 | 59 | free(zOut); |
| 60 | 60 | free(zIn); |
| 61 | 61 | return rc; |
| 62 | 62 | } |
| 63 | 63 |
| --- src/clearsign.c | |
| +++ src/clearsign.c | |
| @@ -52,11 +52,11 @@ | |
| 52 | }else{ |
| 53 | if( pOut!=pIn ){ |
| 54 | blob_copy(pOut, pIn); |
| 55 | } |
| 56 | } |
| 57 | unlink(zOut); |
| 58 | unlink(zIn); |
| 59 | free(zOut); |
| 60 | free(zIn); |
| 61 | return rc; |
| 62 | } |
| 63 |
| --- src/clearsign.c | |
| +++ src/clearsign.c | |
| @@ -52,11 +52,11 @@ | |
| 52 | }else{ |
| 53 | if( pOut!=pIn ){ |
| 54 | blob_copy(pOut, pIn); |
| 55 | } |
| 56 | } |
| 57 | file_delete(zOut); |
| 58 | file_delete(zIn); |
| 59 | free(zOut); |
| 60 | free(zIn); |
| 61 | return rc; |
| 62 | } |
| 63 |
+1
-1
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -100,11 +100,11 @@ | ||
| 100 | 100 | g.xlinkClusterOnly = 0; |
| 101 | 101 | verify_cancel(); |
| 102 | 102 | db_end_transaction(0); |
| 103 | 103 | db_close(1); |
| 104 | 104 | if( nErr ){ |
| 105 | - unlink(g.argv[3]); | |
| 105 | + file_delete(g.argv[3]); | |
| 106 | 106 | fossil_fatal("server returned an error - clone aborted"); |
| 107 | 107 | } |
| 108 | 108 | db_open_repository(g.argv[3]); |
| 109 | 109 | } |
| 110 | 110 | db_begin_transaction(); |
| 111 | 111 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -100,11 +100,11 @@ | |
| 100 | g.xlinkClusterOnly = 0; |
| 101 | verify_cancel(); |
| 102 | db_end_transaction(0); |
| 103 | db_close(1); |
| 104 | if( nErr ){ |
| 105 | unlink(g.argv[3]); |
| 106 | fossil_fatal("server returned an error - clone aborted"); |
| 107 | } |
| 108 | db_open_repository(g.argv[3]); |
| 109 | } |
| 110 | db_begin_transaction(); |
| 111 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -100,11 +100,11 @@ | |
| 100 | g.xlinkClusterOnly = 0; |
| 101 | verify_cancel(); |
| 102 | db_end_transaction(0); |
| 103 | db_close(1); |
| 104 | if( nErr ){ |
| 105 | file_delete(g.argv[3]); |
| 106 | fossil_fatal("server returned an error - clone aborted"); |
| 107 | } |
| 108 | db_open_repository(g.argv[3]); |
| 109 | } |
| 110 | db_begin_transaction(); |
| 111 |
M
src/db.c
+1
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -151,11 +151,11 @@ | ||
| 151 | 151 | if( nBegin ){ |
| 152 | 152 | sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0); |
| 153 | 153 | nBegin = 0; |
| 154 | 154 | if( isNewRepo ){ |
| 155 | 155 | db_close(0); |
| 156 | - unlink(g.zRepositoryName); | |
| 156 | + file_delete(g.zRepositoryName); | |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | busy = 0; |
| 160 | 160 | db_close(0); |
| 161 | 161 | } |
| 162 | 162 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -151,11 +151,11 @@ | |
| 151 | if( nBegin ){ |
| 152 | sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0); |
| 153 | nBegin = 0; |
| 154 | if( isNewRepo ){ |
| 155 | db_close(0); |
| 156 | unlink(g.zRepositoryName); |
| 157 | } |
| 158 | } |
| 159 | busy = 0; |
| 160 | db_close(0); |
| 161 | } |
| 162 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -151,11 +151,11 @@ | |
| 151 | if( nBegin ){ |
| 152 | sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0); |
| 153 | nBegin = 0; |
| 154 | if( isNewRepo ){ |
| 155 | db_close(0); |
| 156 | file_delete(g.zRepositoryName); |
| 157 | } |
| 158 | } |
| 159 | busy = 0; |
| 160 | db_close(0); |
| 161 | } |
| 162 |
+3
-3
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -99,11 +99,11 @@ | ||
| 99 | 99 | |
| 100 | 100 | /* Run the external diff command */ |
| 101 | 101 | fossil_system(blob_str(&cmd)); |
| 102 | 102 | |
| 103 | 103 | /* Delete the temporary file and clean up memory used */ |
| 104 | - unlink(blob_str(&nameFile1)); | |
| 104 | + file_delete(blob_str(&nameFile1)); | |
| 105 | 105 | blob_reset(&nameFile1); |
| 106 | 106 | blob_reset(&cmd); |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| @@ -153,12 +153,12 @@ | ||
| 153 | 153 | |
| 154 | 154 | /* Run the external diff command */ |
| 155 | 155 | fossil_system(blob_str(&cmd)); |
| 156 | 156 | |
| 157 | 157 | /* Delete the temporary file and clean up memory used */ |
| 158 | - unlink(zTemp1); | |
| 159 | - unlink(zTemp2); | |
| 158 | + file_delete(zTemp1); | |
| 159 | + file_delete(zTemp2); | |
| 160 | 160 | blob_reset(&cmd); |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /* |
| 165 | 165 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -99,11 +99,11 @@ | |
| 99 | |
| 100 | /* Run the external diff command */ |
| 101 | fossil_system(blob_str(&cmd)); |
| 102 | |
| 103 | /* Delete the temporary file and clean up memory used */ |
| 104 | unlink(blob_str(&nameFile1)); |
| 105 | blob_reset(&nameFile1); |
| 106 | blob_reset(&cmd); |
| 107 | } |
| 108 | } |
| 109 | |
| @@ -153,12 +153,12 @@ | |
| 153 | |
| 154 | /* Run the external diff command */ |
| 155 | fossil_system(blob_str(&cmd)); |
| 156 | |
| 157 | /* Delete the temporary file and clean up memory used */ |
| 158 | unlink(zTemp1); |
| 159 | unlink(zTemp2); |
| 160 | blob_reset(&cmd); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | /* |
| 165 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -99,11 +99,11 @@ | |
| 99 | |
| 100 | /* Run the external diff command */ |
| 101 | fossil_system(blob_str(&cmd)); |
| 102 | |
| 103 | /* Delete the temporary file and clean up memory used */ |
| 104 | file_delete(blob_str(&nameFile1)); |
| 105 | blob_reset(&nameFile1); |
| 106 | blob_reset(&cmd); |
| 107 | } |
| 108 | } |
| 109 | |
| @@ -153,12 +153,12 @@ | |
| 153 | |
| 154 | /* Run the external diff command */ |
| 155 | fossil_system(blob_str(&cmd)); |
| 156 | |
| 157 | /* Delete the temporary file and clean up memory used */ |
| 158 | file_delete(zTemp1); |
| 159 | file_delete(zTemp2); |
| 160 | blob_reset(&cmd); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | /* |
| 165 |
+44
-1
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -133,10 +133,17 @@ | ||
| 133 | 133 | if( z[0]=='/' ) zTail = &z[1]; |
| 134 | 134 | z++; |
| 135 | 135 | } |
| 136 | 136 | return zTail; |
| 137 | 137 | } |
| 138 | + | |
| 139 | +/* | |
| 140 | +** Delete a file. | |
| 141 | +*/ | |
| 142 | +void file_delete(const char *zFilename){ | |
| 143 | + unlink(zFilename); | |
| 144 | +} | |
| 138 | 145 | |
| 139 | 146 | /* |
| 140 | 147 | ** Copy the content of a file from one place to another. |
| 141 | 148 | */ |
| 142 | 149 | void file_copy(const char *zFrom, const char *zTo){ |
| @@ -151,10 +158,46 @@ | ||
| 151 | 158 | fwrite(zBuf, 1, got, out); |
| 152 | 159 | } |
| 153 | 160 | fclose(in); |
| 154 | 161 | fclose(out); |
| 155 | 162 | } |
| 163 | + | |
| 164 | +/* | |
| 165 | +** Rename a file. | |
| 166 | +*/ | |
| 167 | +void file_move(const char *zFrom, const char *zTo){ | |
| 168 | +#if defined(_WIN32) | |
| 169 | + /* if( MoveFileW(zFrom, zTo) ) return; */ | |
| 170 | +#else | |
| 171 | + if( rename(zFrom, zTo)==0 ) return; | |
| 172 | +#endif | |
| 173 | + file_copy(zFrom, zTo); | |
| 174 | + file_delete(zFrom); | |
| 175 | +} | |
| 176 | + | |
| 177 | +/* | |
| 178 | +** If the named file exists, move it out of the way so that it will not | |
| 179 | +** be overwritten by subsequent operations. | |
| 180 | +*/ | |
| 181 | +void file_dont_overwrite(const char *z){ | |
| 182 | + char *zNow; | |
| 183 | + char *zNewName; | |
| 184 | + int cnt = 0; | |
| 185 | + if( file_mtime(z)<0 ) return; | |
| 186 | + if( !file_isfile(0) ){ | |
| 187 | + fossil_fatal("cannot overwrite \"%s\" - not an ordinary file"); | |
| 188 | + } | |
| 189 | + zNow = db_text(0, "SELECT strftime('%%Y%%m%%d%%H%%M%%S', 'now')"); | |
| 190 | + while(1){ | |
| 191 | + zNewName = mprintf("%s-%s-%d", z, zNow, cnt++); | |
| 192 | + if( file_mtime(zNewName)<0 ) break; | |
| 193 | + fossil_free(zNewName); | |
| 194 | + } | |
| 195 | + fossil_free(zNow); | |
| 196 | + file_move(z, zNewName); | |
| 197 | + fossil_free(zNewName); | |
| 198 | +} | |
| 156 | 199 | |
| 157 | 200 | /* |
| 158 | 201 | ** Set or clear the execute bit on a file. |
| 159 | 202 | */ |
| 160 | 203 | void file_setexe(const char *zFilename, int onoff){ |
| @@ -182,11 +225,11 @@ | ||
| 182 | 225 | */ |
| 183 | 226 | int file_mkdir(const char *zName, int forceFlag){ |
| 184 | 227 | int rc = file_isdir(zName); |
| 185 | 228 | if( rc==2 ){ |
| 186 | 229 | if( !forceFlag ) return 1; |
| 187 | - unlink(zName); | |
| 230 | + file_delete(zName); | |
| 188 | 231 | } |
| 189 | 232 | if( rc!=1 ){ |
| 190 | 233 | #if defined(_WIN32) |
| 191 | 234 | return mkdir(zName); |
| 192 | 235 | #else |
| 193 | 236 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -133,10 +133,17 @@ | |
| 133 | if( z[0]=='/' ) zTail = &z[1]; |
| 134 | z++; |
| 135 | } |
| 136 | return zTail; |
| 137 | } |
| 138 | |
| 139 | /* |
| 140 | ** Copy the content of a file from one place to another. |
| 141 | */ |
| 142 | void file_copy(const char *zFrom, const char *zTo){ |
| @@ -151,10 +158,46 @@ | |
| 151 | fwrite(zBuf, 1, got, out); |
| 152 | } |
| 153 | fclose(in); |
| 154 | fclose(out); |
| 155 | } |
| 156 | |
| 157 | /* |
| 158 | ** Set or clear the execute bit on a file. |
| 159 | */ |
| 160 | void file_setexe(const char *zFilename, int onoff){ |
| @@ -182,11 +225,11 @@ | |
| 182 | */ |
| 183 | int file_mkdir(const char *zName, int forceFlag){ |
| 184 | int rc = file_isdir(zName); |
| 185 | if( rc==2 ){ |
| 186 | if( !forceFlag ) return 1; |
| 187 | unlink(zName); |
| 188 | } |
| 189 | if( rc!=1 ){ |
| 190 | #if defined(_WIN32) |
| 191 | return mkdir(zName); |
| 192 | #else |
| 193 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -133,10 +133,17 @@ | |
| 133 | if( z[0]=='/' ) zTail = &z[1]; |
| 134 | z++; |
| 135 | } |
| 136 | return zTail; |
| 137 | } |
| 138 | |
| 139 | /* |
| 140 | ** Delete a file. |
| 141 | */ |
| 142 | void file_delete(const char *zFilename){ |
| 143 | unlink(zFilename); |
| 144 | } |
| 145 | |
| 146 | /* |
| 147 | ** Copy the content of a file from one place to another. |
| 148 | */ |
| 149 | void file_copy(const char *zFrom, const char *zTo){ |
| @@ -151,10 +158,46 @@ | |
| 158 | fwrite(zBuf, 1, got, out); |
| 159 | } |
| 160 | fclose(in); |
| 161 | fclose(out); |
| 162 | } |
| 163 | |
| 164 | /* |
| 165 | ** Rename a file. |
| 166 | */ |
| 167 | void file_move(const char *zFrom, const char *zTo){ |
| 168 | #if defined(_WIN32) |
| 169 | /* if( MoveFileW(zFrom, zTo) ) return; */ |
| 170 | #else |
| 171 | if( rename(zFrom, zTo)==0 ) return; |
| 172 | #endif |
| 173 | file_copy(zFrom, zTo); |
| 174 | file_delete(zFrom); |
| 175 | } |
| 176 | |
| 177 | /* |
| 178 | ** If the named file exists, move it out of the way so that it will not |
| 179 | ** be overwritten by subsequent operations. |
| 180 | */ |
| 181 | void file_dont_overwrite(const char *z){ |
| 182 | char *zNow; |
| 183 | char *zNewName; |
| 184 | int cnt = 0; |
| 185 | if( file_mtime(z)<0 ) return; |
| 186 | if( !file_isfile(0) ){ |
| 187 | fossil_fatal("cannot overwrite \"%s\" - not an ordinary file"); |
| 188 | } |
| 189 | zNow = db_text(0, "SELECT strftime('%%Y%%m%%d%%H%%M%%S', 'now')"); |
| 190 | while(1){ |
| 191 | zNewName = mprintf("%s-%s-%d", z, zNow, cnt++); |
| 192 | if( file_mtime(zNewName)<0 ) break; |
| 193 | fossil_free(zNewName); |
| 194 | } |
| 195 | fossil_free(zNow); |
| 196 | file_move(z, zNewName); |
| 197 | fossil_free(zNewName); |
| 198 | } |
| 199 | |
| 200 | /* |
| 201 | ** Set or clear the execute bit on a file. |
| 202 | */ |
| 203 | void file_setexe(const char *zFilename, int onoff){ |
| @@ -182,11 +225,11 @@ | |
| 225 | */ |
| 226 | int file_mkdir(const char *zName, int forceFlag){ |
| 227 | int rc = file_isdir(zName); |
| 228 | if( rc==2 ){ |
| 229 | if( !forceFlag ) return 1; |
| 230 | file_delete(zName); |
| 231 | } |
| 232 | if( rc!=1 ){ |
| 233 | #if defined(_WIN32) |
| 234 | return mkdir(zName); |
| 235 | #else |
| 236 |
+2
-2
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -242,12 +242,12 @@ | ||
| 242 | 242 | }else if( g.urlIsFile ){ |
| 243 | 243 | if( transport.pFile ){ |
| 244 | 244 | fclose(transport.pFile); |
| 245 | 245 | transport.pFile = 0; |
| 246 | 246 | } |
| 247 | - unlink(transport.zInFile); | |
| 248 | - unlink(transport.zOutFile); | |
| 247 | + file_delete(transport.zInFile); | |
| 248 | + file_delete(transport.zOutFile); | |
| 249 | 249 | free(transport.zInFile); |
| 250 | 250 | free(transport.zOutFile); |
| 251 | 251 | }else{ |
| 252 | 252 | socket_close(); |
| 253 | 253 | } |
| 254 | 254 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -242,12 +242,12 @@ | |
| 242 | }else if( g.urlIsFile ){ |
| 243 | if( transport.pFile ){ |
| 244 | fclose(transport.pFile); |
| 245 | transport.pFile = 0; |
| 246 | } |
| 247 | unlink(transport.zInFile); |
| 248 | unlink(transport.zOutFile); |
| 249 | free(transport.zInFile); |
| 250 | free(transport.zOutFile); |
| 251 | }else{ |
| 252 | socket_close(); |
| 253 | } |
| 254 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -242,12 +242,12 @@ | |
| 242 | }else if( g.urlIsFile ){ |
| 243 | if( transport.pFile ){ |
| 244 | fclose(transport.pFile); |
| 245 | transport.pFile = 0; |
| 246 | } |
| 247 | file_delete(transport.zInFile); |
| 248 | file_delete(transport.zOutFile); |
| 249 | free(transport.zInFile); |
| 250 | free(transport.zOutFile); |
| 251 | }else{ |
| 252 | socket_close(); |
| 253 | } |
| 254 |
+1
-1
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -643,11 +643,11 @@ | ||
| 643 | 643 | pIn = fopen(g.argv[3], "rb"); |
| 644 | 644 | }else{ |
| 645 | 645 | pIn = stdin; |
| 646 | 646 | fossil_binary_mode(pIn); |
| 647 | 647 | } |
| 648 | - if( forceFlag ) unlink(g.argv[2]); | |
| 648 | + if( forceFlag ) file_delete(g.argv[2]); | |
| 649 | 649 | db_create_repository(g.argv[2]); |
| 650 | 650 | db_open_repository(g.argv[2]); |
| 651 | 651 | db_open_config(0); |
| 652 | 652 | db_multi_exec( |
| 653 | 653 | "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, trid INT, tuuid TEXT);" |
| 654 | 654 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -643,11 +643,11 @@ | |
| 643 | pIn = fopen(g.argv[3], "rb"); |
| 644 | }else{ |
| 645 | pIn = stdin; |
| 646 | fossil_binary_mode(pIn); |
| 647 | } |
| 648 | if( forceFlag ) unlink(g.argv[2]); |
| 649 | db_create_repository(g.argv[2]); |
| 650 | db_open_repository(g.argv[2]); |
| 651 | db_open_config(0); |
| 652 | db_multi_exec( |
| 653 | "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, trid INT, tuuid TEXT);" |
| 654 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -643,11 +643,11 @@ | |
| 643 | pIn = fopen(g.argv[3], "rb"); |
| 644 | }else{ |
| 645 | pIn = stdin; |
| 646 | fossil_binary_mode(pIn); |
| 647 | } |
| 648 | if( forceFlag ) file_delete(g.argv[2]); |
| 649 | db_create_repository(g.argv[2]); |
| 650 | db_open_repository(g.argv[2]); |
| 651 | db_open_config(0); |
| 652 | db_multi_exec( |
| 653 | "CREATE TEMP TABLE xtag(tname TEXT UNIQUE, trid INT, tuuid TEXT);" |
| 654 |
+2
-2
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -410,11 +410,11 @@ | ||
| 410 | 410 | db_multi_exec( |
| 411 | 411 | "UPDATE vfile SET deleted=1 WHERE id=%d", idv |
| 412 | 412 | ); |
| 413 | 413 | if( !nochangeFlag ){ |
| 414 | 414 | char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName); |
| 415 | - unlink(zFullPath); | |
| 415 | + file_delete(zFullPath); | |
| 416 | 416 | free(zFullPath); |
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | db_finalize(&q); |
| 420 | 420 | |
| @@ -440,11 +440,11 @@ | ||
| 440 | 440 | ); |
| 441 | 441 | if( !nochangeFlag ){ |
| 442 | 442 | char *zFullOldPath = mprintf("%s%s", g.zLocalRoot, zOldName); |
| 443 | 443 | char *zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName); |
| 444 | 444 | file_copy(zFullOldPath, zFullNewPath); |
| 445 | - unlink(zFullOldPath); | |
| 445 | + file_delete(zFullOldPath); | |
| 446 | 446 | free(zFullNewPath); |
| 447 | 447 | free(zFullOldPath); |
| 448 | 448 | } |
| 449 | 449 | } |
| 450 | 450 | db_finalize(&q); |
| 451 | 451 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -410,11 +410,11 @@ | |
| 410 | db_multi_exec( |
| 411 | "UPDATE vfile SET deleted=1 WHERE id=%d", idv |
| 412 | ); |
| 413 | if( !nochangeFlag ){ |
| 414 | char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName); |
| 415 | unlink(zFullPath); |
| 416 | free(zFullPath); |
| 417 | } |
| 418 | } |
| 419 | db_finalize(&q); |
| 420 | |
| @@ -440,11 +440,11 @@ | |
| 440 | ); |
| 441 | if( !nochangeFlag ){ |
| 442 | char *zFullOldPath = mprintf("%s%s", g.zLocalRoot, zOldName); |
| 443 | char *zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName); |
| 444 | file_copy(zFullOldPath, zFullNewPath); |
| 445 | unlink(zFullOldPath); |
| 446 | free(zFullNewPath); |
| 447 | free(zFullOldPath); |
| 448 | } |
| 449 | } |
| 450 | db_finalize(&q); |
| 451 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -410,11 +410,11 @@ | |
| 410 | db_multi_exec( |
| 411 | "UPDATE vfile SET deleted=1 WHERE id=%d", idv |
| 412 | ); |
| 413 | if( !nochangeFlag ){ |
| 414 | char *zFullPath = mprintf("%s%s", g.zLocalRoot, zName); |
| 415 | file_delete(zFullPath); |
| 416 | free(zFullPath); |
| 417 | } |
| 418 | } |
| 419 | db_finalize(&q); |
| 420 | |
| @@ -440,11 +440,11 @@ | |
| 440 | ); |
| 441 | if( !nochangeFlag ){ |
| 442 | char *zFullOldPath = mprintf("%s%s", g.zLocalRoot, zOldName); |
| 443 | char *zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName); |
| 444 | file_copy(zFullOldPath, zFullNewPath); |
| 445 | file_delete(zFullOldPath); |
| 446 | free(zFullNewPath); |
| 447 | free(zFullOldPath); |
| 448 | } |
| 449 | } |
| 450 | db_finalize(&q); |
| 451 |
+2
-2
| --- src/stash.c | ||
| +++ src/stash.c | ||
| @@ -188,11 +188,11 @@ | ||
| 188 | 188 | db_ephemeral_blob(&q, 5, &delta); |
| 189 | 189 | blob_write_to_file(&delta, zNPath); |
| 190 | 190 | printf("ADD %s\n", zNew); |
| 191 | 191 | }else if( isRemoved ){ |
| 192 | 192 | printf("DELETE %s\n", zOrig); |
| 193 | - unlink(zOPath); | |
| 193 | + file_delete(zOPath); | |
| 194 | 194 | }else{ |
| 195 | 195 | Blob a, b, out, disk; |
| 196 | 196 | db_ephemeral_blob(&q, 5, &delta); |
| 197 | 197 | blob_read_from_file(&disk, zOPath); |
| 198 | 198 | content_get(rid, &a); |
| @@ -216,11 +216,11 @@ | ||
| 216 | 216 | blob_reset(&disk); |
| 217 | 217 | } |
| 218 | 218 | blob_reset(&delta); |
| 219 | 219 | if( fossil_strcmp(zOrig,zNew)!=0 ){ |
| 220 | 220 | undo_save(zOrig); |
| 221 | - unlink(zOPath); | |
| 221 | + file_delete(zOPath); | |
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | db_finalize(&q); |
| 225 | 225 | if( nConflict ){ |
| 226 | 226 | printf("WARNING: merge conflicts - see messages above for details.\n"); |
| 227 | 227 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -188,11 +188,11 @@ | |
| 188 | db_ephemeral_blob(&q, 5, &delta); |
| 189 | blob_write_to_file(&delta, zNPath); |
| 190 | printf("ADD %s\n", zNew); |
| 191 | }else if( isRemoved ){ |
| 192 | printf("DELETE %s\n", zOrig); |
| 193 | unlink(zOPath); |
| 194 | }else{ |
| 195 | Blob a, b, out, disk; |
| 196 | db_ephemeral_blob(&q, 5, &delta); |
| 197 | blob_read_from_file(&disk, zOPath); |
| 198 | content_get(rid, &a); |
| @@ -216,11 +216,11 @@ | |
| 216 | blob_reset(&disk); |
| 217 | } |
| 218 | blob_reset(&delta); |
| 219 | if( fossil_strcmp(zOrig,zNew)!=0 ){ |
| 220 | undo_save(zOrig); |
| 221 | unlink(zOPath); |
| 222 | } |
| 223 | } |
| 224 | db_finalize(&q); |
| 225 | if( nConflict ){ |
| 226 | printf("WARNING: merge conflicts - see messages above for details.\n"); |
| 227 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -188,11 +188,11 @@ | |
| 188 | db_ephemeral_blob(&q, 5, &delta); |
| 189 | blob_write_to_file(&delta, zNPath); |
| 190 | printf("ADD %s\n", zNew); |
| 191 | }else if( isRemoved ){ |
| 192 | printf("DELETE %s\n", zOrig); |
| 193 | file_delete(zOPath); |
| 194 | }else{ |
| 195 | Blob a, b, out, disk; |
| 196 | db_ephemeral_blob(&q, 5, &delta); |
| 197 | blob_read_from_file(&disk, zOPath); |
| 198 | content_get(rid, &a); |
| @@ -216,11 +216,11 @@ | |
| 216 | blob_reset(&disk); |
| 217 | } |
| 218 | blob_reset(&delta); |
| 219 | if( fossil_strcmp(zOrig,zNew)!=0 ){ |
| 220 | undo_save(zOrig); |
| 221 | file_delete(zOPath); |
| 222 | } |
| 223 | } |
| 224 | db_finalize(&q); |
| 225 | if( nConflict ){ |
| 226 | printf("WARNING: merge conflicts - see messages above for details.\n"); |
| 227 |
+1
-1
| --- src/undo.c | ||
| +++ src/undo.c | ||
| @@ -59,11 +59,11 @@ | ||
| 59 | 59 | printf("NEW %s\n", zPathname); |
| 60 | 60 | } |
| 61 | 61 | blob_write_to_file(&new, zFullname); |
| 62 | 62 | }else{ |
| 63 | 63 | printf("DELETE %s\n", zPathname); |
| 64 | - unlink(zFullname); | |
| 64 | + file_delete(zFullname); | |
| 65 | 65 | } |
| 66 | 66 | blob_reset(&new); |
| 67 | 67 | free(zFullname); |
| 68 | 68 | db_finalize(&q); |
| 69 | 69 | db_prepare(&q, |
| 70 | 70 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -59,11 +59,11 @@ | |
| 59 | printf("NEW %s\n", zPathname); |
| 60 | } |
| 61 | blob_write_to_file(&new, zFullname); |
| 62 | }else{ |
| 63 | printf("DELETE %s\n", zPathname); |
| 64 | unlink(zFullname); |
| 65 | } |
| 66 | blob_reset(&new); |
| 67 | free(zFullname); |
| 68 | db_finalize(&q); |
| 69 | db_prepare(&q, |
| 70 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -59,11 +59,11 @@ | |
| 59 | printf("NEW %s\n", zPathname); |
| 60 | } |
| 61 | blob_write_to_file(&new, zFullname); |
| 62 | }else{ |
| 63 | printf("DELETE %s\n", zPathname); |
| 64 | file_delete(zFullname); |
| 65 | } |
| 66 | blob_reset(&new); |
| 67 | free(zFullname); |
| 68 | db_finalize(&q); |
| 69 | db_prepare(&q, |
| 70 |
+2
-2
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -358,11 +358,11 @@ | ||
| 358 | 358 | printf("CONFLICT %s - edited locally but deleted by update\n", zName); |
| 359 | 359 | nConflict++; |
| 360 | 360 | }else{ |
| 361 | 361 | printf("REMOVE %s\n", zName); |
| 362 | 362 | undo_save(zName); |
| 363 | - if( !nochangeFlag ) unlink(zFullPath); | |
| 363 | + if( !nochangeFlag ) file_delete(zFullPath); | |
| 364 | 364 | } |
| 365 | 365 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ |
| 366 | 366 | /* Merge the changes in the current tree into the target version */ |
| 367 | 367 | Blob e, r, t, v; |
| 368 | 368 | int rc; |
| @@ -386,11 +386,11 @@ | ||
| 386 | 386 | }else{ |
| 387 | 387 | if( !nochangeFlag ) blob_write_to_file(&t, zFullNewPath); |
| 388 | 388 | printf("***** Cannot merge binary file %s\n", zNewName); |
| 389 | 389 | nConflict++; |
| 390 | 390 | } |
| 391 | - if( nameChng && !nochangeFlag ) unlink(zFullPath); | |
| 391 | + if( nameChng && !nochangeFlag ) file_delete(zFullPath); | |
| 392 | 392 | blob_reset(&v); |
| 393 | 393 | blob_reset(&e); |
| 394 | 394 | blob_reset(&t); |
| 395 | 395 | blob_reset(&r); |
| 396 | 396 | }else{ |
| 397 | 397 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -358,11 +358,11 @@ | |
| 358 | printf("CONFLICT %s - edited locally but deleted by update\n", zName); |
| 359 | nConflict++; |
| 360 | }else{ |
| 361 | printf("REMOVE %s\n", zName); |
| 362 | undo_save(zName); |
| 363 | if( !nochangeFlag ) unlink(zFullPath); |
| 364 | } |
| 365 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ |
| 366 | /* Merge the changes in the current tree into the target version */ |
| 367 | Blob e, r, t, v; |
| 368 | int rc; |
| @@ -386,11 +386,11 @@ | |
| 386 | }else{ |
| 387 | if( !nochangeFlag ) blob_write_to_file(&t, zFullNewPath); |
| 388 | printf("***** Cannot merge binary file %s\n", zNewName); |
| 389 | nConflict++; |
| 390 | } |
| 391 | if( nameChng && !nochangeFlag ) unlink(zFullPath); |
| 392 | blob_reset(&v); |
| 393 | blob_reset(&e); |
| 394 | blob_reset(&t); |
| 395 | blob_reset(&r); |
| 396 | }else{ |
| 397 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -358,11 +358,11 @@ | |
| 358 | printf("CONFLICT %s - edited locally but deleted by update\n", zName); |
| 359 | nConflict++; |
| 360 | }else{ |
| 361 | printf("REMOVE %s\n", zName); |
| 362 | undo_save(zName); |
| 363 | if( !nochangeFlag ) file_delete(zFullPath); |
| 364 | } |
| 365 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ |
| 366 | /* Merge the changes in the current tree into the target version */ |
| 367 | Blob e, r, t, v; |
| 368 | int rc; |
| @@ -386,11 +386,11 @@ | |
| 386 | }else{ |
| 387 | if( !nochangeFlag ) blob_write_to_file(&t, zFullNewPath); |
| 388 | printf("***** Cannot merge binary file %s\n", zNewName); |
| 389 | nConflict++; |
| 390 | } |
| 391 | if( nameChng && !nochangeFlag ) file_delete(zFullPath); |
| 392 | blob_reset(&v); |
| 393 | blob_reset(&e); |
| 394 | blob_reset(&t); |
| 395 | blob_reset(&r); |
| 396 | }else{ |
| 397 |
+1
-1
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -268,11 +268,11 @@ | ||
| 268 | 268 | " WHERE vid=%d AND mrid>0", g.zLocalRoot, vid); |
| 269 | 269 | while( db_step(&q)==SQLITE_ROW ){ |
| 270 | 270 | const char *zName; |
| 271 | 271 | |
| 272 | 272 | zName = db_column_text(&q, 0); |
| 273 | - unlink(zName); | |
| 273 | + file_delete(zName); | |
| 274 | 274 | } |
| 275 | 275 | db_finalize(&q); |
| 276 | 276 | db_multi_exec("UPDATE vfile SET mtime=NULL WHERE vid=%d AND mrid>0", vid); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -268,11 +268,11 @@ | |
| 268 | " WHERE vid=%d AND mrid>0", g.zLocalRoot, vid); |
| 269 | while( db_step(&q)==SQLITE_ROW ){ |
| 270 | const char *zName; |
| 271 | |
| 272 | zName = db_column_text(&q, 0); |
| 273 | unlink(zName); |
| 274 | } |
| 275 | db_finalize(&q); |
| 276 | db_multi_exec("UPDATE vfile SET mtime=NULL WHERE vid=%d AND mrid>0", vid); |
| 277 | } |
| 278 | |
| 279 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -268,11 +268,11 @@ | |
| 268 | " WHERE vid=%d AND mrid>0", g.zLocalRoot, vid); |
| 269 | while( db_step(&q)==SQLITE_ROW ){ |
| 270 | const char *zName; |
| 271 | |
| 272 | zName = db_column_text(&q, 0); |
| 273 | file_delete(zName); |
| 274 | } |
| 275 | db_finalize(&q); |
| 276 | db_multi_exec("UPDATE vfile SET mtime=NULL WHERE vid=%d AND mrid>0", vid); |
| 277 | } |
| 278 | |
| 279 |
+3
-3
| --- src/winhttp.c | ||
| +++ src/winhttp.c | ||
| @@ -123,12 +123,12 @@ | ||
| 123 | 123 | |
| 124 | 124 | end_request: |
| 125 | 125 | if( out ) fclose(out); |
| 126 | 126 | if( in ) fclose(in); |
| 127 | 127 | closesocket(p->s); |
| 128 | - unlink(zRequestFName); | |
| 129 | - unlink(zReplyFName); | |
| 128 | + file_delete(zRequestFName); | |
| 129 | + file_delete(zReplyFName); | |
| 130 | 130 | free(p); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /* |
| 134 | 134 | ** Start a listening socket and process incoming HTTP requests on |
| @@ -146,11 +146,11 @@ | ||
| 146 | 146 | SOCKADDR_IN addr; |
| 147 | 147 | int idCnt = 0; |
| 148 | 148 | int iPort = mnPort; |
| 149 | 149 | char *zNotFoundOption; |
| 150 | 150 | |
| 151 | - if( zStopper ) unlink(zStopper); | |
| 151 | + if( zStopper ) file_delete(zStopper); | |
| 152 | 152 | if( zNotFound ){ |
| 153 | 153 | zNotFoundOption = mprintf(" --notfound %s", zNotFound); |
| 154 | 154 | }else{ |
| 155 | 155 | zNotFoundOption = ""; |
| 156 | 156 | } |
| 157 | 157 |
| --- src/winhttp.c | |
| +++ src/winhttp.c | |
| @@ -123,12 +123,12 @@ | |
| 123 | |
| 124 | end_request: |
| 125 | if( out ) fclose(out); |
| 126 | if( in ) fclose(in); |
| 127 | closesocket(p->s); |
| 128 | unlink(zRequestFName); |
| 129 | unlink(zReplyFName); |
| 130 | free(p); |
| 131 | } |
| 132 | |
| 133 | /* |
| 134 | ** Start a listening socket and process incoming HTTP requests on |
| @@ -146,11 +146,11 @@ | |
| 146 | SOCKADDR_IN addr; |
| 147 | int idCnt = 0; |
| 148 | int iPort = mnPort; |
| 149 | char *zNotFoundOption; |
| 150 | |
| 151 | if( zStopper ) unlink(zStopper); |
| 152 | if( zNotFound ){ |
| 153 | zNotFoundOption = mprintf(" --notfound %s", zNotFound); |
| 154 | }else{ |
| 155 | zNotFoundOption = ""; |
| 156 | } |
| 157 |
| --- src/winhttp.c | |
| +++ src/winhttp.c | |
| @@ -123,12 +123,12 @@ | |
| 123 | |
| 124 | end_request: |
| 125 | if( out ) fclose(out); |
| 126 | if( in ) fclose(in); |
| 127 | closesocket(p->s); |
| 128 | file_delete(zRequestFName); |
| 129 | file_delete(zReplyFName); |
| 130 | free(p); |
| 131 | } |
| 132 | |
| 133 | /* |
| 134 | ** Start a listening socket and process incoming HTTP requests on |
| @@ -146,11 +146,11 @@ | |
| 146 | SOCKADDR_IN addr; |
| 147 | int idCnt = 0; |
| 148 | int iPort = mnPort; |
| 149 | char *zNotFoundOption; |
| 150 | |
| 151 | if( zStopper ) file_delete(zStopper); |
| 152 | if( zNotFound ){ |
| 153 | zNotFoundOption = mprintf(" --notfound %s", zNotFound); |
| 154 | }else{ |
| 155 | zNotFoundOption = ""; |
| 156 | } |
| 157 |