aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_wrappers.c
diff options
context:
space:
mode:
authorPeter Seebach <seebs@eee12.(none)>2010-06-02 16:47:28 -0500
committerPeter Seebach <seebs@eee12.(none)>2010-06-02 16:47:28 -0500
commit602626f84e9c06463fc8f5f92caad041b3a30d9b (patch)
tree7cc8b7a77cce7a4fe082c37dbb44eb94ca6a6d2c /pseudo_wrappers.c
parent0c52672c99b98ab0e4b9d12c78d3b0ddadbdf3c5 (diff)
downloadpseudo-602626f84e9c06463fc8f5f92caad041b3a30d9b.tar.gz
pseudo-602626f84e9c06463fc8f5f92caad041b3a30d9b.tar.bz2
pseudo-602626f84e9c06463fc8f5f92caad041b3a30d9b.zip
Provide a hook to disable symlink "fixing".
In fakechroot, which pseudo tries to match the functionality of, the default behavior when creating a symlink with an absolute target is to prepend the chroot path, so that underlying syscalls will get the right file. It is necessary to be able to disable this behavior to create target filesystems in some cases. To that end, support a new environment variable, PSEUDO_NOSYMLINKEXP, which disables that behavior.
Diffstat (limited to 'pseudo_wrappers.c')
-rw-r--r--pseudo_wrappers.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c
index ae4e698..fd51e9a 100644
--- a/pseudo_wrappers.c
+++ b/pseudo_wrappers.c
@@ -121,6 +121,7 @@ pseudo_populate_wrappers(void) {
char *debug;
static int done = 0;
char *pseudo_path = 0;
+ char *no_symlink_exp;
if (done)
return done;
@@ -149,6 +150,27 @@ pseudo_populate_wrappers(void) {
pseudo_debug_verbose();
}
}
+ no_symlink_exp = getenv("PSEUDO_NOSYMLINKEXP");
+ if (no_symlink_exp) {
+ char *endptr;
+ /* if the environment variable is not an empty string,
+ * parse it; "0" means turn NOSYMLINKEXP off, "1" means
+ * turn it on (disabling the feature). An empty string
+ * or something we can't parse means to set the flag; this
+ * is a safe default because if you didn't want the flag
+ * set, you normally wouldn't set the environment variable
+ * at all.
+ */
+ if (*no_symlink_exp) {
+ pseudo_nosymlinkexp = strtol(no_symlink_exp, &endptr, 10);
+ if (*endptr)
+ pseudo_nosymlinkexp = 1;
+ } else {
+ pseudo_nosymlinkexp = 1;
+ }
+ } else {
+ pseudo_nosymlinkexp = 0;
+ }
/* if PSEUDO_DEBUG_FILE is set up, redirect logging there.
*/
pseudo_logfile(NULL);