Fixed missing icons bug in index.theme parsing and a path concatenation bug in find_inherits()

This commit is contained in:
David McKinney 2018-03-24 12:49:15 -04:00
parent 6726f2402d
commit 8d95d2f924
No known key found for this signature in database
GPG key ID: 8EE175192D714F23

View file

@ -28,7 +28,7 @@
/* Finds all themes that the given theme inherits */ /* Finds all themes that the given theme inherits */
static list_t *find_inherits(const char *theme_dir) { static list_t *find_inherits(const char *theme_dir) {
const char inherits[] = "Inherits"; const char inherits[] = "Inherits";
const char index_name[] = "index.theme"; const char index_name[] = "/index.theme";
list_t *themes = create_list(); list_t *themes = create_list();
FILE *index = NULL; FILE *index = NULL;
char *path = malloc(strlen(theme_dir) + sizeof(index_name)); char *path = malloc(strlen(theme_dir) + sizeof(index_name));
@ -253,6 +253,10 @@ static list_t* find_theme_subdirs(const char *theme_dir) {
} }
if (strncmp(directories, buf, sizeof(directories) - 1) == 0) { if (strncmp(directories, buf, sizeof(directories) - 1) == 0) {
char *dirstr = buf + sizeof(directories); char *dirstr = buf + sizeof(directories);
int len = strlen(dirstr);
if (dirstr[len-1] == '\n') {
dirstr[len-1] = '\0';
}
dirs = split_subdirs(dirstr); dirs = split_subdirs(dirstr);
break; break;
} }