From: KO Myung-Hun Date: Tue, 9 Dec 2014 01:40:48 +0000 (+0900) Subject: relocatable: support UNIXROOT in relocate() on EMX X-Git-Tag: v1.0~7231 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=cc0009850129a39e514e00df66a7b5cc3609fb87;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 31ee240025..f6f65c84b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-12-08 KO Myung-Hun + + * lib/relocatable.c (relocate): Prepend $UNIXROOT to pathname if it is + started with '/' on EMX. + 2014-12-08 KO Myung-Hun freopen: workaround freopen() on OS/2 kLIBC 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; }