diff --git a/Makefile b/Makefile index 8ad92c1..add20e7 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: sxiv -VERSION=git-20110315 +VERSION=git-20110317 CC?=gcc PREFIX?=/usr/local diff --git a/main.c b/main.c index 558980e..95857a9 100644 --- a/main.c +++ b/main.c @@ -246,7 +246,8 @@ void read_dir_rec(const char *dirname) { len = strlen(dirname) + strlen(dentry->d_name) + 2; filename = (char*) s_malloc(len * sizeof(char)); - snprintf(filename, len, "%s/%s", dirname, dentry->d_name); + snprintf(filename, len, "%s%s%s", dirname, + dirname[strlen(dirname)-1] == '/' ? "" : "/", dentry->d_name); if (!stat(filename, &fstats) && S_ISDIR(fstats.st_mode)) { if (diridx == dircnt) {