Check if cmd exist before xstrdup it in mousebind_section and remove fifo if it exists before init
This commit is contained in:
parent
ade67b66ee
commit
545b1a2a7e
@ -14,8 +14,9 @@
|
|||||||
static void
|
static void
|
||||||
config_mouse_section(struct mbhead *mousebinds, struct conf_sec **sec)
|
config_mouse_section(struct mbhead *mousebinds, struct conf_sec **sec)
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
struct mousebind *m;
|
struct mousebind *m;
|
||||||
|
int i = 0;
|
||||||
|
char *p;
|
||||||
|
|
||||||
SLIST_INIT(mousebinds);
|
SLIST_INIT(mousebinds);
|
||||||
|
|
||||||
@ -25,7 +26,10 @@ config_mouse_section(struct mbhead *mousebinds, struct conf_sec **sec)
|
|||||||
|
|
||||||
m->button = fetch_opt_first(sec[i], "1", "button").num;
|
m->button = fetch_opt_first(sec[i], "1", "button").num;
|
||||||
m->func = uicb_name_func(fetch_opt_first(sec[i], "", "func").str);
|
m->func = uicb_name_func(fetch_opt_first(sec[i], "", "func").str);
|
||||||
m->cmd = xstrdup(fetch_opt_first(sec[i], "", "cmd").str);
|
|
||||||
|
if((p = fetch_opt_first(sec[i], "", "cmd").str))
|
||||||
|
m->cmd = xstrdup(p);
|
||||||
|
|
||||||
m->use_area = false;
|
m->use_area = false;
|
||||||
|
|
||||||
SLIST_INSERT_HEAD(mousebinds, m, next);
|
SLIST_INSERT_HEAD(mousebinds, m, next);
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
* For license, see COPYING.
|
* For license, see COPYING.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/stat.h> /* access */
|
||||||
|
|
||||||
#include "wmfs.h"
|
#include "wmfs.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -24,6 +26,10 @@ fifo_init(void)
|
|||||||
{
|
{
|
||||||
xasprintf(&(W->fifo.path), "%s/wmfs-%s.fifo", P_tmpdir, DisplayString(W->dpy));
|
xasprintf(&(W->fifo.path), "%s/wmfs-%s.fifo", P_tmpdir, DisplayString(W->dpy));
|
||||||
|
|
||||||
|
/* Check if fifo already exists */
|
||||||
|
if(access(W->fifo.path, F_OK) != -1)
|
||||||
|
unlink(W->fifo.path);
|
||||||
|
|
||||||
if(mkfifo(W->fifo.path, 0644) < 0)
|
if(mkfifo(W->fifo.path, 0644) < 0)
|
||||||
warnx("Can't create FIFO: %s\n", strerror(errno));
|
warnx("Can't create FIFO: %s\n", strerror(errno));
|
||||||
|
|
||||||
|
|||||||
6
wmfsrc
6
wmfsrc
@ -90,9 +90,9 @@
|
|||||||
[client]
|
[client]
|
||||||
|
|
||||||
[mouse] button = "1" func = "client_focus_click" [/mouse]
|
[mouse] button = "1" func = "client_focus_click" [/mouse]
|
||||||
[mouse] button = "1" func = "mouse_swap" [/mouse]
|
[mouse] button = "1" func = "mouse_swap" [/mouse]
|
||||||
[mouse] button = "2" func = "mouse_tab" [/mouse]
|
[mouse] button = "2" func = "mouse_tab" [/mouse]
|
||||||
[mouse] button = "3" func = "mouse_resize" [/mouse]
|
[mouse] button = "3" func = "mouse_resize" [/mouse]
|
||||||
|
|
||||||
[/client]
|
[/client]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user