if ((fd = open(lockfile, O_WRONLY | O_EXCL | O_CREAT, 0))
>= 0) {
close(fd);
+ res = 0;
break;
}
/* we are not going to create default mailbox */
fd = open(path, O_RDWR);
- if (fd < 0)
- return -1;
+ if (fd < 0){
+ dot_unlock(path);
+ return -1;
+ }
/* hide it again */
setresgid(ruid, ruid, suid);
if (fd < 0 && errno == ENOENT){
fd = open(path, O_RDWR | O_CREAT | O_EXCL,
S_IRUSR | S_IWUSR);
- if (fd < 0)
+ if (fd < 0){
+ dot_unlock(path);
return -1;
+ }
- } else if (fd < 0)
- return -1;
+ } else if (fd < 0){
+ dot_unlock(path);
+ return -1;
+ }
}
/* fcntl then */
char* mb = argv[1];
getresgid(&ruid, &euid, &suid);
setresgid(ruid, ruid, euid);
- fd = open_mailbox(mb, 1);
+ fd = open_mailbox(mb, 0);
printf("%d\n", fd);
if (fd < 0)
return 1;