slackbuilds/desktop/wmxss/libexecpath.diff

60 lines
1.5 KiB
Diff

diff -Naur wmxss-0.1.orig/Src/wmxss.c wmxss-0.1/Src/wmxss.c
--- wmxss-0.1.orig/Src/wmxss.c 1999-08-11 17:29:02.000000000 -0400
+++ wmxss-0.1/Src/wmxss.c 2016-08-16 03:37:20.306233811 -0400
@@ -43,6 +43,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <limits.h>
#include <X11/X.h>
#include <X11/xpm.h>
#include "xutils.h"
@@ -71,7 +72,8 @@
int GotFirstClick3, GotDoubleClick3;
int DblClkDelay;
int HasExecute;
-char ExecuteCommand[1024];
+char ExecuteCommand[PATH_MAX];
+char env_path[PATH_MAX];
@@ -93,8 +95,16 @@
XEvent event;
int n;
- char Command[512];
+ char Command[PATH_MAX];
+ char *env_path, new_path[PATH_MAX];
+ /* 20160816 bkw: export PATH=/usr/libexec/xscreensaver:$PATH */
+ if( !(env_path = getenv("PATH")) )
+ strcpy(new_path, "PATH=/usr/libexec/xscreensaver");
+ else
+ snprintf(new_path, PATH_MAX - 1, "PATH=/usr/libexec/xscreensaver:%s", env_path);
+
+ putenv(new_path);
/*
* Parse any command line arguments.
@@ -113,7 +123,7 @@
if (HasExecute){
- sprintf(Command, "%s -window-id 0x%x &", ExecuteCommand, (int)iconwin);
+ snprintf(Command, PATH_MAX - 1, "%s -window-id 0x%x &", ExecuteCommand, (int)iconwin);
system(Command);
}
@@ -245,8 +255,8 @@
print_usage();
exit(-1);
}
- strcpy(ExecuteCommand, argv[++i]);
- HasExecute = 1;
+ strcpy(ExecuteCommand, argv[++i]);
+ HasExecute = 1;
} else {