aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/cstreams.c
diff options
context:
space:
mode:
authorNicolas Roche <roche@adacore.com>2007-04-06 11:18:36 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-04-06 11:18:36 +0200
commitb150b431d0a9b4dc0c3302b4257ecc209c33fba1 (patch)
tree816123e9b77187babfffea963436935f3f060430 /gcc/ada/cstreams.c
parent41ccd2d8c88353d35a3c3f220a7aff2d57ae2dca (diff)
downloadgcc-b150b431d0a9b4dc0c3302b4257ecc209c33fba1.zip
gcc-b150b431d0a9b4dc0c3302b4257ecc209c33fba1.tar.gz
gcc-b150b431d0a9b4dc0c3302b4257ecc209c33fba1.tar.bz2
cstreams.c (__gnat_full_name): Fix issues on VxWorks 6.x for which absolute path can have the following form...
2007-04-06 Nicolas Roche <roche@adacore.com> * cstreams.c (__gnat_full_name): Fix issues on VxWorks 6.x for which absolute path can have the following form: device:/a/b. In this case '/' should be inserted between the path and the filename. From-SVN: r123556
Diffstat (limited to 'gcc/ada/cstreams.c')
-rw-r--r--gcc/ada/cstreams.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c
index 8f283d4..a45487b 100644
--- a/gcc/ada/cstreams.c
+++ b/gcc/ada/cstreams.c
@@ -6,7 +6,7 @@
* *
* Auxiliary C functions for Interfaces.C.Streams *
* *
- * Copyright (C) 1992-2003 Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2006, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -211,10 +211,20 @@ __gnat_full_name (char *nam, char *buffer)
return 0;
}
+#ifdef __vxworks
+ /* On VxWorks, getcwd always returns an absolute path. But this path
+ can be also a device name like "serial:". In this case '/' should not
+ be appended. As on VxWorks 6.x the returned path can starts with
+ the device name (ex: machine:/directory), we need to test if the last
+ character of the path is ':' to know if '/' should be appended. */
+ if (buffer[strlen (buffer) - 1] != ':')
+ strcat (buffer, "/");
+#else
/* If the name returned is an absolute path, it is safe to append '/'
to the path and concatenate the name of the file. */
if (buffer[0] == '/')
strcat (buffer, "/");
+#endif
strcat (buffer, nam);
}