2
libfakechroot -- fake chroot environment
3
Copyright (c) 2010 Piotr Roszatycki <dexter@debian.org>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
15
You should have received a copy of the GNU Lesser General Public
16
License along with this library; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
#include "libfakechroot.h"
27
wrapper(glob, int, (const char * pattern, int flags, int (* errfunc) (const char *, int), glob_t * pglob))
30
char tmp[FAKECHROOT_PATH_MAX], *tmpptr;
31
char *fakechroot_path, *fakechroot_ptr, fakechroot_buf[FAKECHROOT_PATH_MAX];
33
debug("glob(\"%s\", %d, &errfunc, &pglob)", pattern, flags);
34
expand_chroot_path(pattern, fakechroot_path, fakechroot_buf);
36
rc = nextcall(glob)(pattern, flags, errfunc, pglob);
40
for (i = 0; i < pglob->gl_pathc; i++) {
41
strcpy(tmp,pglob->gl_pathv[i]);
42
fakechroot_path = getenv("FAKECHROOT_BASE");
43
if (fakechroot_path != NULL) {
44
fakechroot_ptr = strstr(tmp, fakechroot_path);
45
if (fakechroot_ptr != tmp) {
48
tmpptr = tmp + strlen(fakechroot_path);
50
strcpy(pglob->gl_pathv[i], tmpptr);