c448746c28
from ian mcwilliam
30 lines
843 B
Plaintext
30 lines
843 B
Plaintext
$OpenBSD: patch-lock_maildrop_c,v 1.2 2005/12/14 06:02:09 jolan Exp $
|
|
--- lock_maildrop.c.orig Mon Aug 18 03:44:55 2003
|
|
+++ lock_maildrop.c Mon Nov 28 11:40:13 2005
|
|
@@ -35,7 +35,7 @@ int lock_maildrop(char * maildrop, uid_t
|
|
}
|
|
for (i=0;i<5;i++) {
|
|
/* only create file when it doesn't exist */
|
|
- fd = open(lf,O_WRONLY|O_EXCL|O_CREAT,0600);
|
|
+ fd = open(lf,O_WRONLY|O_EXCL|O_CREAT,0660);
|
|
if (fd < 0)
|
|
sleep(1);
|
|
else
|
|
@@ -49,13 +49,14 @@ int lock_maildrop(char * maildrop, uid_t
|
|
return 1;
|
|
}
|
|
|
|
-void remove_lock(char * maildrop) {
|
|
+int remove_lock(char * maildrop) {
|
|
size_t lf_len = (size_t)strlen(maildrop)+strlen(".lock")+1;
|
|
char * lf = alloca(lf_len);
|
|
if (lf!=NULL) {
|
|
snprintf(lf,lf_len,"%s.lock",maildrop);
|
|
- unlink(lf);
|
|
+ return unlink(lf);
|
|
}
|
|
+ return -2;
|
|
}
|
|
|
|
int lock_fd(int fd) {
|