libexecpath.diff 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. diff -Naur wmxss-0.1.orig/Src/wmxss.c wmxss-0.1/Src/wmxss.c
  2. --- wmxss-0.1.orig/Src/wmxss.c 1999-08-11 17:29:02.000000000 -0400
  3. +++ wmxss-0.1/Src/wmxss.c 2016-08-16 03:37:20.306233811 -0400
  4. @@ -43,6 +43,7 @@
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include <time.h>
  8. +#include <limits.h>
  9. #include <X11/X.h>
  10. #include <X11/xpm.h>
  11. #include "xutils.h"
  12. @@ -71,7 +72,8 @@
  13. int GotFirstClick3, GotDoubleClick3;
  14. int DblClkDelay;
  15. int HasExecute;
  16. -char ExecuteCommand[1024];
  17. +char ExecuteCommand[PATH_MAX];
  18. +char env_path[PATH_MAX];
  19. @@ -93,8 +95,16 @@
  20. XEvent event;
  21. int n;
  22. - char Command[512];
  23. + char Command[PATH_MAX];
  24. + char *env_path, new_path[PATH_MAX];
  25. + /* 20160816 bkw: export PATH=/usr/libexec/xscreensaver:$PATH */
  26. + if( !(env_path = getenv("PATH")) )
  27. + strcpy(new_path, "PATH=/usr/libexec/xscreensaver");
  28. + else
  29. + snprintf(new_path, PATH_MAX - 1, "PATH=/usr/libexec/xscreensaver:%s", env_path);
  30. +
  31. + putenv(new_path);
  32. /*
  33. * Parse any command line arguments.
  34. @@ -113,7 +123,7 @@
  35. if (HasExecute){
  36. - sprintf(Command, "%s -window-id 0x%x &", ExecuteCommand, (int)iconwin);
  37. + snprintf(Command, PATH_MAX - 1, "%s -window-id 0x%x &", ExecuteCommand, (int)iconwin);
  38. system(Command);
  39. }
  40. @@ -245,8 +255,8 @@
  41. print_usage();
  42. exit(-1);
  43. }
  44. - strcpy(ExecuteCommand, argv[++i]);
  45. - HasExecute = 1;
  46. + strcpy(ExecuteCommand, argv[++i]);
  47. + HasExecute = 1;
  48. } else {