summaryrefslogtreecommitdiff
path: root/lib/relocatable.c
diff options
context:
space:
mode:
authorKO Myung-Hun <komh78@gmail.com>2014-12-09 10:40:48 +0900
committerBen Pfaff <blp@cs.stanford.edu>2014-12-08 21:57:09 -0800
commitcc0009850129a39e514e00df66a7b5cc3609fb87 (patch)
treebe2458fbebe9f2bbff303bd10939c791a04f3389 /lib/relocatable.c
parent3c4e08331004fb2c43d42f521e1b546222ef8d6e (diff)
downloadgnulib-cc0009850129a39e514e00df66a7b5cc3609fb87.tar.gz
relocatable: support UNIXROOT in relocate() on EMX
UNIXROOT is used to specify a drive of a root of FHS. So if a path is started with '/', then it should be translated to "$UNIXROOT/". * lib/relocatable.c (relocate): Prepend $UNIXROOT to pathname if it is started with '/' on EMX.
Diffstat (limited to 'lib/relocatable.c')
-rw-r--r--lib/relocatable.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/relocatable.c b/lib/relocatable.c
index 6c6ea1cf6b..1d6fdd5df6 100644
--- a/lib/relocatable.c
+++ b/lib/relocatable.c
@@ -537,6 +537,27 @@ relocate (const char *pathname)
}
}
}
+
+#ifdef __EMX__
+ if (pathname && ISSLASH (pathname[0]))
+ {
+ const char *unixroot = getenv ("UNIXROOT");
+
+ if (unixroot && HAS_DEVICE (unixroot) && !unixroot[2])
+ {
+ char *result = (char *) xmalloc (2 + strlen (pathname) + 1);
+#ifdef NO_XMALLOC
+ if (result != NULL)
+#endif
+ {
+ strcpy (result, unixroot);
+ strcpy (result + 2, pathname);
+ return result;
+ }
+ }
+ }
+#endif
+
/* Nothing to relocate. */
return pathname;
}