3 Commits
v1.0 ... v1.1

Author SHA1 Message Date
59dc46c98f update version number 2024-06-16 14:36:20 -04:00
e900a948c8 add more error handling 2024-06-16 14:36:02 -04:00
1c52faa753 save 32 bits of memory on startup 2024-06-16 13:24:11 -04:00
2 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,5 @@
PKG_CONFIG = pkg-config PKG_CONFIG = pkg-config
VERSION = 1.0 VERSION = 1.1
# flags and incs # flags and incs
PKGS = wayland-client wayland-server PKGS = wayland-client wayland-server

10
wiz.c
View File

@ -21,8 +21,6 @@ static struct wl_seat *seat;
static const struct ext_idle_notification_v1_listener idlelistener; static const struct ext_idle_notification_v1_listener idlelistener;
static const struct wl_registry_listener reglistener; static const struct wl_registry_listener reglistener;
pid_t cpid;
struct Events { struct Events {
uint32_t delay; /* in ms */ uint32_t delay; /* in ms */
char **idlecmd; char **idlecmd;
@ -94,12 +92,16 @@ static const struct ext_idle_notification_v1_listener idlelistener = {
static void static void
run(char **cmd) run(char **cmd)
{ {
static pid_t cpid;
waitpid(-1, NULL, WNOHANG); waitpid(-1, NULL, WNOHANG);
if (killchild && cpid) if (killchild && cpid)
kill(cpid, SIGINT); kill(cpid, SIGINT);
if (cmd && (cpid = fork()) == 0) { if (cmd && (cpid = fork()) == 0) {
dup2(STDERR_FILENO, STDOUT_FILENO); if (dup2(STDERR_FILENO, STDOUT_FILENO) == -1)
setsid(); die("dup2 failed:");
if (setsid() == -1)
die("setsid failed:");
execvp(cmd[0], cmd); execvp(cmd[0], cmd);
die("execvp failed:"); die("execvp failed:");
} }