perpd-restore_umask.patch 672 B

12345678910111213141516171819202122232425262728293031323334
  1. --- perp/perpd.c.orig 2013-01-11 12:10:32.000000000 -0300
  2. +++ perp/perpd.c 2017-05-19 14:11:30.000000000 -0300
  3. @@ -217,8 +217,9 @@
  4. void
  5. perpd_control_init(void)
  6. {
  7. - int fdbase;
  8. - int fd = -1;
  9. + int fdbase;
  10. + int fd = -1;
  11. + mode_t umask_orig;
  12. /* setup for return to base directory: */
  13. if((fdbase = open(".", O_RDONLY)) == -1){
  14. @@ -226,7 +227,7 @@
  15. }
  16. /* setup umask for intentional mode on file creation: */
  17. - umask(0);
  18. + umask_orig = umask(0);
  19. /* initialize .control directory: */
  20. if(mkdir(PERP_CONTROL, 0700) == -1){
  21. @@ -286,6 +287,9 @@
  22. }
  23. close(fdbase);
  24. + /* restore umask: */
  25. + umask(umask_orig);
  26. +
  27. return;
  28. }