From 20296b25676638ddeeb05d18623373655bd48133 Mon Sep 17 00:00:00 2001
From: yorhel <yorhel@ce56bc8d-f834-0410-b703-f827bd498a76>
Date: Sun, 11 Jan 2009 09:30:53 +0000
Subject: [PATCH] Fixed rpath() bug on /.

git-svn-id: svn://blicky.net/ncdu/trunk@47 ce56bc8d-f834-0410-b703-f827bd498a76
---
 ChangeLog  | 1 +
 src/calc.c | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 26ce6f4..2e87740 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@ svn - ?
 	- Current directory is assumed when no directory is specified
 	- Size graph uses the apparent size if that is displayed
 	- Items are ordered by displayed size rather than disk usage
+	- Fixed rpath() bug on '/.'
 
 1.4 - 2008-09-10
 	- Removed the startup window
diff --git a/src/calc.c b/src/calc.c
index 325b226..b06c6ba 100644
--- a/src/calc.c
+++ b/src/calc.c
@@ -101,6 +101,11 @@ char *rpath(const char *from, char *to) {
       break;
   }
   to[j+1] = 0;
+ /* make sure we do have something left in case our path is / */
+  if(to[0] == 0) {
+    to[0] = '/';
+    to[1] = 0;
+  }
  /* append 'app' */
   if(app[0] != 0)
     strcat(to, app);
-- 
GitLab