Filename cosmetics

This commit is contained in:
Bert 2011-03-17 23:39:17 +01:00
parent 55659ffcc3
commit 87a9828417
2 changed files with 3 additions and 2 deletions

View file

@ -1,6 +1,6 @@
all: sxiv all: sxiv
VERSION=git-20110315 VERSION=git-20110317
CC?=gcc CC?=gcc
PREFIX?=/usr/local PREFIX?=/usr/local

3
main.c
View file

@ -246,7 +246,8 @@ void read_dir_rec(const char *dirname) {
len = strlen(dirname) + strlen(dentry->d_name) + 2; len = strlen(dirname) + strlen(dentry->d_name) + 2;
filename = (char*) s_malloc(len * sizeof(char)); 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 (!stat(filename, &fstats) && S_ISDIR(fstats.st_mode)) {
if (diridx == dircnt) { if (diridx == dircnt) {