]> git.ipfire.org Git - people/ms/dma.git/commitdiff
dma: don't block when trying to aquire a queue file
authorSimon Schubert <corecode@dragonflybsd.org>
Tue, 21 Jul 2009 23:21:44 +0000 (01:21 +0200)
committerSimon Schubert <corecode@dragonflybsd.org>
Tue, 21 Jul 2009 23:21:44 +0000 (01:21 +0200)
We might race with some other process, so it is imperative to treat a
locked file as a soft error instead of blocking on the file until the
other process unlocks it.

spool.c

diff --git a/spool.c b/spool.c
index d9d17e28392173feb583cc90e7540b6cd34f12c3..9a74620220ce7364ca5a2845427a636c14569102 100644 (file)
--- a/spool.c
+++ b/spool.c
@@ -308,7 +308,7 @@ aquirespool(struct qitem *it)
        int queuefd;
 
        if (it->queuef == NULL) {
-               queuefd = open_locked(it->queuefn, O_RDWR);
+               queuefd = open_locked(it->queuefn, O_RDWR|O_NONBLOCK);
                if (queuefd < 0)
                        goto fail;
                it->queuef = fdopen(queuefd, "r+");