Module Name:    othersrc
Committed By:   stacktic
Date:           Tue Nov 17 15:10:13 UTC 2009

Modified Files:
        othersrc/lib/libfsu_utils: fsu_dir.c

Log Message:
Fixed fsu_getcwd


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 othersrc/lib/libfsu_utils/fsu_dir.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/lib/libfsu_utils/fsu_dir.c
diff -u othersrc/lib/libfsu_utils/fsu_dir.c:1.4 othersrc/lib/libfsu_utils/fsu_dir.c:1.5
--- othersrc/lib/libfsu_utils/fsu_dir.c:1.4	Thu Nov  5 14:02:43 2009
+++ othersrc/lib/libfsu_utils/fsu_dir.c	Tue Nov 17 15:10:13 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: fsu_dir.c,v 1.4 2009/11/05 14:02:43 stacktic Exp $ */
+/* $NetBSD: fsu_dir.c,v 1.5 2009/11/17 15:10:13 stacktic Exp $ */
 
 /*
  * Copyright (c) 2008,2009 Arnaud Ysmal.  All Rights Reserved.
@@ -242,10 +242,14 @@
 	if (dirname == NULL)
 		goto err;
 
-        dirname[0] = '\0';
-	for (; i >= 0; --i) {
-		strlcat(dirname, names[i], len);
+        dirname[0] = '/';
+	dirname[1] = '\0';
+	free(names[0]);
+	for (--i; i >= 0; --i) {
+		rv = strlcat(dirname, names[i], len);
 		free(names[i]);
+		dirname[rv] = '/';
+		dirname[rv + 1] = '\0';
 	}
 	free(names);
 

Reply via email to