* utilunix.c (canonicalize_pathname) [__QNX__]: Fix detection

of Qnet names.  Disable support of Qnet names under QNX Netrino.
Reported by Maurizio Rossi <MRossi@system-group.it>
This commit is contained in:
Pavel Roskin 2002-02-18 22:31:56 +00:00
parent 2b7cf88d85
commit 6c67d1918c
2 changed files with 48 additions and 46 deletions

View File

@ -1,5 +1,9 @@
2002-02-18 Pavel Roskin <proski@gnu.org> 2002-02-18 Pavel Roskin <proski@gnu.org>
* utilunix.c (canonicalize_pathname) [__QNX__]: Fix detection
of Qnet names. Disable support of Qnet names under QNX Netrino.
Reported by Maurizio Rossi <MRossi@system-group.it>
* global.h: Include unix.h under "classical" QNX. * global.h: Include unix.h under "classical" QNX.
* subshell.c: Don't include unix.h. * subshell.c: Don't include unix.h.
* utilunix.c: Likewise. * utilunix.c: Likewise.

View File

@ -584,23 +584,20 @@ char *canonicalize_pathname (char *path)
if (!path[start]) if (!path[start])
break; break;
#if defined(__QNX__) #if defined(__QNX__) && !defined(__QNXNTO__)
/* /*
** QNX accesses the directories of nodes on its peer-to-peer ** QNX accesses the directories of nodes on its peer-to-peer
** network by prefixing their directories with "//[nid]". ** network (Qnet) by prefixing their directories with "//[nid]".
** We don't want to collapse two '/'s if they're at the start ** We don't want to collapse two '/'s if they're at the start
** of the path, followed by digits, and ending with a '/'. ** of the path, followed by digits, and ending with a '/'.
*/ */
if (start == 0 && i == 1) if (start == 0 && path[1] == PATH_SEP) {
{
char *p = path + 2; char *p = path + 2;
char *q = strchr (p, PATH_SEP); char *q = strchr (p, PATH_SEP);
if (q > p) if (q > p) {
{
*q = 0; *q = 0;
if (!strcspn(p, "0123456789")) if (!strcspn (p, "0123456789")) {
{
start = q - path; start = q - path;
i = start + 1; i = start + 1;
} }
@ -641,7 +638,8 @@ char *canonicalize_pathname (char *path)
/* Handle `../' or trailing `..' by itself. /* Handle `../' or trailing `..' by itself.
Remove the previous ?/ part with the exception of Remove the previous ?/ part with the exception of
../, which we should leave intact. */ ../, which we should leave intact. */
if (path[i + 1] == '.' && (path[i + 2] == PATH_SEP || !path[i + 2])) { if (path[i + 1] == '.'
&& (path[i + 2] == PATH_SEP || !path[i + 2])) {
while (--start > -1 && path[start] != PATH_SEP); while (--start > -1 && path[start] != PATH_SEP);
if (!strncmp (path + start + 1, "../", 3)) if (!strncmp (path + start + 1, "../", 3))
continue; continue;