Bug #1416 » 0001-Fix-queue-file-seek-position-races-by-locking.patch
libexec/dma/dma.c | ||
---|---|---|
const char *errmsg = "unknown bounce reason";
|
||
struct timeval now;
|
||
struct stat st;
|
||
struct flock fl;
|
||
syslog(LOG_INFO, "%s: mail from=<%s> to=<%s>",
|
||
it->queueid, it->sender, it->addr);
|
||
... | ... | |
syslog(LOG_INFO, "%s: trying delivery",
|
||
it->queueid);
|
||
bzero(&fl, sizeof(fl));
|
||
fl.l_type = F_WRLCK;
|
||
fl.l_whence = SEEK_SET;
|
||
if (fcntl(fileno(it->queuef), F_SETLKW, &fl) == -1) {
|
||
syslog(LOG_ERR, "%s: failed to lock queue file: %m",
|
||
it->queueid);
|
||
goto bounce;
|
||
}
|
||
if (it->remote)
|
||
error = deliver_remote(it, &errmsg);
|
||
else
|
||
error = deliver_local(it, &errmsg);
|
||
bzero(&fl, sizeof(fl));
|
||
fl.l_type = F_UNLCK;
|
||
fl.l_whence = SEEK_SET;
|
||
if (fcntl(fileno(it->queuef), F_SETLKW, &fl) == -1) {
|
||
syslog(LOG_ERR, "%s: failed to unlock queue file: %m",
|
||
it->queueid);
|
||
/* let `error' decide whether we bounce or not */
|
||
}
|
||
switch (error) {
|
||
case 0:
|
||
unlink(it->queuefn);
|
- « Previous
- 1
- …
- 4
- 5
- 6
- Next »