]> Savannah Git Hosting - gnulib.git/commitdiff
relocatable: support UNIXROOT in relocate() on EMX
authorKO Myung-Hun <komh78@gmail.com>
Tue, 9 Dec 2014 01:40:48 +0000 (10:40 +0900)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 9 Dec 2014 05:57:09 +0000 (21:57 -0800)
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.

ChangeLog
lib/relocatable.c

index 31ee2400254f3939f500c4189be65f525c6b9318..f6f65c84b0a8aaa70896d4d46de800b73481aa0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 6c6ea1cf6b11fda895c81a27c925399b2ab04b5c..1d6fdd5df66d1ae2891fcb74d4454fe1e9c948e5 100644 (file)
@@ -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;
 }