aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-11-26 21:53:24 -0500
committerMike Frysinger <vapier@gentoo.org>2010-11-26 21:53:24 -0500
commit2c90a2dd2d5be3ca593a7bcd8d79e6d0db296204 (patch)
treefd3f6f23fa24f305d9333100507e52174ad9d07d /libsandbox/libsandbox.c
parenttests: allow dirfds to specify mode too (diff)
downloadsandbox-2c90a2dd2d5be3ca593a7bcd8d79e6d0db296204.tar.gz
sandbox-2c90a2dd2d5be3ca593a7bcd8d79e6d0db296204.tar.bz2
sandbox-2c90a2dd2d5be3ca593a7bcd8d79e6d0db296204.zip
libsandbox: fix utimensat regression with NULL filename
The previous commit (libsandbox: handle dirfd in mkdir/open/unlink *at prechecks) unified some path checks while unifying the dirfd code, but prevented valid NULL paths from also being handled. Make sure we still handle that behavior, and add a test for it to prevent future regressions. URL: http://bugs.gentoo.org/346815 Reported-by: Jake Todd <jaketodd422@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsandbox/libsandbox.c')
-rw-r--r--libsandbox/libsandbox.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c
index 908a150..041abe8 100644
--- a/libsandbox/libsandbox.c
+++ b/libsandbox/libsandbox.c
@@ -154,7 +154,7 @@ int resolve_dirfd_path(int dirfd, const char *path, char *resolved_path,
* Since maintaining fd state based on open's is real messy, we'll
* just rely on the kernel doing it for us with /proc/<pid>/fd/ ...
*/
- if (dirfd == AT_FDCWD || !path || path[0] == '/')
+ if (dirfd == AT_FDCWD || (path && path[0] == '/'))
return 1;
save_errno();