]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tdb: Update times in tdb_transaction_commit per fd, not per name
authorVolker Lendecke <vl@samba.org>
Fri, 14 Jun 2024 15:48:52 +0000 (17:48 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 24 Jun 2024 16:21:32 +0000 (16:21 +0000)
We might have a relative filename in tdb->name, so we might do the
wrong thing here. And as we have the fd, why not use it...

We call futimens in vfs_default without #ifdef and it's Posix 2018 or
before. So I don't think we need to check for it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/tdb/common/transaction.c

index 78bbd7ad23e16090db7aa1545c71880aee6cfc21..b4dec1024a0533a7d13d9d741ff35d7e5a40727f 100644 (file)
@@ -1206,9 +1206,7 @@ _PUBLIC_ int tdb_transaction_commit(struct tdb_context *tdb)
           not be backed up (as tdb rounding to block sizes means that
           file size changes are quite rare too). The following forces
           mtime changes when a transaction completes */
-#ifdef HAVE_UTIME
-       utime(tdb->name, NULL);
-#endif
+       futimens(tdb->fd, NULL);
 
        /* use a transaction cancel to free memory and remove the
           transaction locks */