Package: fakechroot
Version: 2.14-1
Severity: normal
Tags: patch

Hi,

fakechroot doesnt wrap faccessat which is for example used by /bin/sh to
do a [ -r /some/file ] check.

the attached patch adds this missing functionality.

cheers, josch
diff --git a/configure.ac b/configure.ac
index 34a4bfd..086e8a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -121,6 +121,7 @@ AC_CHECK_FUNCS(m4_normalize([
     _xftw
     _xftw64
     access
+    faccessat
     acct
     bind
     bindtextdomain
diff --git a/src/Makefile.am b/src/Makefile.am
index c851dc7..09effd8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,6 +26,7 @@ libfakechroot_la_SOURCES = \
     _xftw.c \
     _xftw64.c \
     access.c \
+    faccessat.c \
     acct.c \
     bind.c \
     bindtextdomain.c \
diff --git a/src/faccessat.c b/src/faccessat.c
new file mode 100644
index 0000000..e42c70c
--- /dev/null
+++ b/src/faccessat.c
@@ -0,0 +1,32 @@
+/*
+    libfakechroot -- fake chroot environment
+    Copyright (c) 2010 Piotr Roszatycki <dex...@debian.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+*/
+
+
+#include <config.h>
+
+#include "libfakechroot.h"
+
+
+wrapper(faccessat, int, (int dirfd, const char * pathname, int mode, int flags))
+{
+    char *fakechroot_path, fakechroot_buf[FAKECHROOT_PATH_MAX];
+    debug("faccessat(%d, \"%s\", %d, %d)", dirfd, pathname, mode, flags);
+    expand_chroot_path(pathname, fakechroot_path, fakechroot_buf);
+    return nextcall(faccessat)(dirfd, pathname, mode, flags);
+}

Reply via email to