corecode's projects
/
dragonfly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
2922fd2
)
dma: lock temp files on creation
author
Simon Schubert <corecode@dragonflybsd.org>
Thu, 9 Jul 2009 12:37:16 +0000 (14:37 +0200)
committer
Simon Schubert <corecode@dragonflybsd.org>
Thu, 16 Jul 2009 14:13:05 +0000 (16:13 +0200)
Lock the temporary files after creating them to protect from a "dma -q"
run at just the wrong time causing a double delivery attempt for
the same message.
Submitted-by: Peter Pentchev <roam@ringlet.net>
libexec/dma/dma.c
patch
|
blob
|
blame
|
history
diff --git
a/libexec/dma/dma.c
b/libexec/dma/dma.c
index
3ca9826
..
6599635
100644
(file)
--- a/
libexec/dma/dma.c
+++ b/
libexec/dma/dma.c
@@
-223,6
+223,8
@@
gentempf(struct queue *queue)
fd = mkstemp(fn);
if (fd < 0)
return (-1);
+ if (flock(fd, LOCK_EX) == -1)
+ return (-1);
queue->mailfd = fd;
queue->tmpf = strdup(fn);
if (queue->tmpf == NULL) {