Krolyxon
Commit 87a9828

Branches

Refs →

nsxiv87a9828

Filename cosmetics

Author
Bert
Date
2011-03-17 23:39 +0100
Parent
55659ff
Commit
87a982841757da100993839b9c0002c2548838bc

+3 −2

2 files changed

  1. M Makefile +1 −1
  2. M main.c +2 −1
M Makefile View
@@ -1,6 +1,6 @@
11 all: sxiv
22
3−VERSION=git-20110315
3+VERSION=git-20110317
44
55 CC?=gcc
66 PREFIX?=/usr/local
M main.c View
@@ -246,7 +246,8 @@ void read_dir_rec(const char *dirname) {
246246
247247 len = strlen(dirname) + strlen(dentry->d_name) + 2;
248248 filename = (char*) s_malloc(len * sizeof(char));
249− snprintf(filename, len, "%s/%s", dirname, dentry->d_name);
249+ snprintf(filename, len, "%s%s%s", dirname,
250+ dirname[strlen(dirname)-1] == '/' ? "" : "/", dentry->d_name);
250251
251252 if (!stat(filename, &fstats) && S_ISDIR(fstats.st_mode)) {
252253 if (diridx == dircnt) {