From 13f103ac8c4b74ea05658a6a71d03d98b22a7253 Mon Sep 17 00:00:00 2001 From: Reginald Kennedy Date: Sun, 22 Jul 2012 18:08:39 +0800 Subject: [PATCH] Fix user bar_font not being applied to dmenu. --- spectrwm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spectrwm.c b/spectrwm.c index 14716c7..8e94b16 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -1848,7 +1848,7 @@ bar_refresh(void) void bar_setup(struct swm_region *r) { - char *font, *fontpos; + char *font, *fontpos, *dup, *search; int count; xcb_screen_t *screen = get_screen(r->s->idx); uint32_t wa[3]; @@ -1861,7 +1861,10 @@ bar_setup(struct swm_region *r) err(1, "bar_setup: calloc: failed to allocate memory."); if (bar_font == NULL) { - while ((font = strsep(&bar_fonts, ",")) != NULL) { + if ((dup = strdup(bar_fonts)) == NULL) + errx(1, "insufficient memory."); + search = dup; + while ((font = strsep(&search, ",")) != NULL) { if (*font == '\0') continue; @@ -1889,6 +1892,7 @@ bar_setup(struct swm_region *r) break; } } + free(dup); } if (bar_font == NULL) -- 2.39.2