summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mg_db.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mg_db.c b/mg_db.c
index 9e54519..f6a7a91 100644
--- a/mg_db.c
+++ b/mg_db.c
@@ -1218,7 +1218,10 @@ mgDb::SyncFile(const char *filename) {
int tldlen = strlen(the_setup.ToplevelDir);
int cwdlen = strlen(cwd);
const char *relpath=cwd;
- if (cwdlen>tldlen) relpath += tldlen;
+ if (cwdlen>tldlen)
+ relpath += tldlen;
+ else if (cwdlen==tldlen)
+ relpath = "";
char *b;
msprintf(&b,"%s%s",relpath,cfilename);
free((void*)cwd);