From b1026aeda9a6fb2ea411a37d0db9ea516e417bd2 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 6 Dec 2022 13:12:33 +0000 Subject: 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 --- src/os_unix.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/os_unix.c') diff --git a/src/os_unix.c b/src/os_unix.c index ddb6f0c07..d248703e9 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -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); -- cgit v1.2.3