changeset 37507:26b21bf2b9d1

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.
author KO Myung-Hun <komh78@gmail.com>
date Tue, 09 Dec 2014 10:40:48 +0900
parents fb0cd26533e7
children cb83917db93b
files ChangeLog lib/relocatable.c
diffstat 2 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Dec 05 15:01:36 2014 +0900
+++ b/ChangeLog	Tue Dec 09 10:40:48 2014 +0900
@@ -1,3 +1,8 @@
+2014-12-08  KO Myung-Hun  <komh78@gmail.com>
+
+	* lib/relocatable.c (relocate): Prepend $UNIXROOT to pathname if it is
+	started with '/' on EMX.
+
 2014-12-08  KO Myung-Hun  <komh78@gmail.com>
 
 	freopen: workaround freopen() on OS/2 kLIBC
--- a/lib/relocatable.c	Fri Dec 05 15:01:36 2014 +0900
+++ b/lib/relocatable.c	Tue Dec 09 10:40:48 2014 +0900
@@ -537,6 +537,27 @@
             }
         }
     }
+
+#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;
 }