1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-21 13:38:01 +03:00

In the unix backend, when implementing the defenses against small file

descriptors, delete a file just created if it was opened with
O_EXCL|O_CREAT so that it can be created again the next time through the
loop.  Fix for the problem described by
[forum:/forumpost/699af709ab3a8ccf|forum post 699af709ab3a8ccf].

FossilOrigin-Name: c0cfe0582add87981826d124a0763482f51fae4b105b5a970dd56919f1d04d60
This commit is contained in:
drh
2022-12-06 13:12:33 +00:00
parent 109f173b6f
commit b1026aeda9
3 changed files with 11 additions and 8 deletions

View File

@@ -686,6 +686,9 @@ static int robust_open(const char *z, int f, mode_t m){
break;
}
if( fd>=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break;
if( (f & (O_EXCL|O_CREAT))==(O_EXCL|O_CREAT) ){
(void)osUnlink(z);
}
osClose(fd);
sqlite3_log(SQLITE_WARNING,
"attempt to open \"%s\" as file descriptor %d", z, fd);