+2017-05-16 Bruno Haible <bruno@clisp.org>
+
+ relocate: Simplify EMX specific code.
+ * lib/relocatable.c (relocate): Assume pathname is non-NULL. Use
+ ISSLASH macro consistently. Avoid dangerous string concatenation idiom.
+
2017-05-16 Bruno Haible <bruno@clisp.org>
sigpipe tests: Fix file list.
# ifdef __KLIBC__
# undef strncmp
- if (pathname && strncmp (pathname, "/@unixroot", 10) == 0
- && (pathname[10] == '\0' || pathname[10] == '/' || pathname[10] == '\\'))
+ if (strncmp (pathname, "/@unixroot", 10) == 0
+ && (pathname[10] == '\0' || ISSLASH (pathname[10])))
{
/* kLIBC itself processes /@unixroot prefix */
-
return pathname;
}
else
# endif
- if (pathname && ISSLASH (pathname[0]))
+ if (ISSLASH (pathname[0]))
{
const char *unixroot = getenv ("UNIXROOT");
- if (unixroot && HAS_DEVICE (unixroot) && !unixroot[2])
+ if (unixroot && HAS_DEVICE (unixroot) && unixroot[2] == '\0')
{
char *result = (char *) xmalloc (2 + strlen (pathname) + 1);
#ifdef NO_XMALLOC
if (result != NULL)
#endif
{
- strcpy (result, unixroot);
+ memcpy (result, unixroot, 2);
strcpy (result + 2, pathname);
return result;
}