commit:     c603a83d4699861cefd1da38fb94c0025891553d
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Mon Nov  4 19:02:51 2024 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Nov  4 19:14:39 2024 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=c603a83d

Fix behavior of utimensat(..., AT_EMPTY_PATH)

Bug: https://bugs.gentoo.org/935716
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
(cherry picked from commit 69000bb059a57560762b979e7957f96decb25f10)

 libsandbox/libsandbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c
index e0928bb..18e9626 100644
--- a/libsandbox/libsandbox.c
+++ b/libsandbox/libsandbox.c
@@ -1064,7 +1064,7 @@ bool before_syscall(int dirfd, int sb_nr, const char 
*func, const char *file, in
         * the rest should get rejected as "file/directory does not exist".
         */
        if (file == NULL || file[0] == '\0') {
-               if (file == NULL && dirfd != AT_FDCWD &&
+               if ((file == NULL || (flags & AT_EMPTY_PATH)) &&
                        (sb_nr == SB_NR_UTIMENSAT || sb_nr == SB_NR_FUTIMESAT))
                {
                        /* let it slide -- the func is magic and changes 
behavior

Reply via email to