Add libgen.h include and guard against basename(3) modifying its arg

This commit is contained in:
Dmitri Goutnik 2017-08-15 10:44:32 -05:00
parent 99c74b8703
commit bf98183098

View File

@ -13,6 +13,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <libgen.h>
#include "dbus.h" #include "dbus.h"
#include "dunst.h" #include "dunst.h"
@ -313,10 +314,12 @@ int notification_init(notification * n, int id)
n->markup); n->markup);
if (n->icon) { if (n->icon) {
n->msg = notification_replace_format("%I", basename(n->icon), char *tmp = g_strdup(n->icon);
n->msg = notification_replace_format("%I", basename(tmp),
n->msg, MARKUP_NO); n->msg, MARKUP_NO);
n->msg = notification_replace_format("%i", n->icon, n->msg = notification_replace_format("%i", n->icon,
n->msg, MARKUP_NO); n->msg, MARKUP_NO);
g_free(tmp);
} }
if (n->progress) { if (n->progress) {