patch-lock_maildrop_c 843 B

123456789101112131415161718192021222324252627282930
  1. $OpenBSD: patch-lock_maildrop_c,v 1.2 2005/12/14 06:02:09 jolan Exp $
  2. --- lock_maildrop.c.orig Mon Aug 18 03:44:55 2003
  3. +++ lock_maildrop.c Mon Nov 28 11:40:13 2005
  4. @@ -35,7 +35,7 @@ int lock_maildrop(char * maildrop, uid_t
  5. }
  6. for (i=0;i<5;i++) {
  7. /* only create file when it doesn't exist */
  8. - fd = open(lf,O_WRONLY|O_EXCL|O_CREAT,0600);
  9. + fd = open(lf,O_WRONLY|O_EXCL|O_CREAT,0660);
  10. if (fd < 0)
  11. sleep(1);
  12. else
  13. @@ -49,13 +49,14 @@ int lock_maildrop(char * maildrop, uid_t
  14. return 1;
  15. }
  16. -void remove_lock(char * maildrop) {
  17. +int remove_lock(char * maildrop) {
  18. size_t lf_len = (size_t)strlen(maildrop)+strlen(".lock")+1;
  19. char * lf = alloca(lf_len);
  20. if (lf!=NULL) {
  21. snprintf(lf,lf_len,"%s.lock",maildrop);
  22. - unlink(lf);
  23. + return unlink(lf);
  24. }
  25. + return -2;
  26. }
  27. int lock_fd(int fd) {