summaryrefslogtreecommitdiffstats
path: root/desktop/wmxss/libexecpath.diff
blob: 9dffc2f65d4d04102727260083df315f8738a28c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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 {