summaryrefslogtreecommitdiff
path: root/libyasm
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2009-06-03 05:49:18 +0000
committerPeter Johnson <peter@tortall.net>2009-06-03 05:49:18 +0000
commita4987364549e185c8b94d73eb9cd0b4a604d660e (patch)
tree479e0b29196efb1c5f52abc54f39b1f068705b40 /libyasm
parent9752153285b44f10f78e9bc5feffa20d946c6cec (diff)
downloadyasm-a4987364549e185c8b94d73eb9cd0b4a604d660e.tar.gz
Fix #173: Debug full paths were being generated incorrectly.
This was because the path returned by yasm__getcwd() did not have a trailing slash and thus yasm__combpath() stripped off the last path component. svn path=/trunk/yasm/; revision=2202
Diffstat (limited to 'libyasm')
-rw-r--r--libyasm/file.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libyasm/file.c b/libyasm/file.c
index 01359de3..fa225af0 100644
--- a/libyasm/file.c
+++ b/libyasm/file.c
@@ -235,7 +235,7 @@ yasm__getcwd(void)
size = 1024;
buf = yasm_xmalloc(size);
- while (getcwd(buf, size) == NULL) {
+ while (getcwd(buf, size-1) == NULL) {
if (errno != ERANGE) {
yasm__fatal(N_("could not determine current working directory"));
yasm_xfree(buf);
@@ -244,6 +244,13 @@ yasm__getcwd(void)
size *= 2;
buf = yasm_xrealloc(buf, size);
}
+
+ /* append a '/' if not already present */
+ size = strlen(buf);
+ if (buf[size-1] != '\\' && buf[size-1] != '/') {
+ buf[size] = '/';
+ buf[size+1] = '\0';
+ }
return buf;
}