bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 09/21] relocatable: support UNIXROOT in relocate() on EMX


From: KO Myung-Hun
Subject: [PATCH 09/21] relocatable: support UNIXROOT in relocate() on EMX
Date: Sun, 30 Nov 2014 13:20:11 +0900

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.
---
 lib/relocatable.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/lib/relocatable.c b/lib/relocatable.c
index c48ed1c..7ce0858 100644
--- a/lib/relocatable.c
+++ b/lib/relocatable.c
@@ -534,6 +534,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;
 }
-- 
1.8.5.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]