xinit-1.3.4-client-session.patch 1013 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --- xinit-1.3.4/xinit.c.client-session 2014-03-25 18:20:26.000000000 +0900
  2. +++ xinit-1.3.4/xinit.c 2014-11-22 20:11:16.301390109 +0900
  3. @@ -89,6 +89,7 @@ char xserverrcbuf[256];
  4. #define TRUE 1
  5. #define FALSE 0
  6. +#define ERR_EXIT 1
  7. static char *default_server = "X";
  8. static char *default_display = ":0"; /* choose most efficient */
  9. @@ -560,6 +561,7 @@ startClient(char *client_argv[])
  10. {
  11. clientpid = fork();
  12. if (clientpid == 0) {
  13. + int fd;
  14. set_environment();
  15. setWindowPath();
  16. @@ -567,7 +569,18 @@ startClient(char *client_argv[])
  17. Error("cannot change uid");
  18. _exit(EXIT_FAILURE);
  19. }
  20. - setpgid(0, getpid());
  21. +
  22. + fd = open ("/dev/null", O_RDONLY);
  23. +
  24. + if (fd < 0) {
  25. + Error("cannot open /dev/null: %s\n", strerror(errno));
  26. + _exit(ERR_EXIT);
  27. + }
  28. + close (STDIN_FILENO);
  29. + dup2 (fd, STDIN_FILENO);
  30. + close (fd);
  31. + setsid();
  32. +
  33. Execute(client_argv);
  34. Error("Unable to run program \"%s\"", client_argv[0]);