[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/4] relocatable: Fix that /@unixroot prefix is not working on OS
From: |
KO Myung-Hun |
Subject: |
[PATCH 2/4] relocatable: Fix that /@unixroot prefix is not working on OS/2 kLIBC |
Date: |
Thu, 1 Dec 2016 19:52:44 +0900 |
OS/2 kLIBC has a feature to rewrite some path components. For example,
'/@unixroot' is replaced with a value of $UNIXROOT if it is.
So prepending a drive letter to the path starting with '/' makes the
path starting with '/@unixroot' to 'x:/@unixroot' which is unexpected.
This will breaks the behavior of some programs depending on /@unixroot
prefix.
* lib/relocatable.c (relocate): Do not touch pathname if it is started
with '/@unixroot'.
---
lib/relocatable.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lib/relocatable.c b/lib/relocatable.c
index 60cb54a..401f3e0 100644
--- a/lib/relocatable.c
+++ b/lib/relocatable.c
@@ -539,6 +539,18 @@ relocate (const char *pathname)
}
#ifdef __EMX__
+# ifdef __KLIBC__
+# undef strncmp
+
+ if (pathname && strncmp (pathname, "/@unixroot", 10) == 0
+ && (pathname[10] == '\0' || pathname[10] == '/' || pathname[10] == '\\'))
+ {
+ /* kLIBC itself processes /@unixroot prefix */
+
+ return pathname;
+ }
+ else
+# endif
if (pathname && ISSLASH (pathname[0]))
{
const char *unixroot = getenv ("UNIXROOT");
--
2.9.2
- [PATCH 0/4] OS/2 patches, KO Myung-Hun, 2016/12/01
- [PATCH 2/4] relocatable: Fix that /@unixroot prefix is not working on OS/2 kLIBC,
KO Myung-Hun <=
- [PATCH 1/4] sys_socket: typedef sa_family_t correctly on OS/2 kLIBC, KO Myung-Hun, 2016/12/01
- [PATCH 3/4] alphasort, scandir: Port to OS/2 kLIBC, KO Myung-Hun, 2016/12/01
- [PATCH 4/4] scandir: Fix _D_ALLOC_NAMLEN() on OS/2 kLIBC, KO Myung-Hun, 2016/12/01
- Re: [PATCH 0/4] OS/2 patches, Pádraig Brady, 2016/12/01