From 4cc637948552123652d0546d8b93cf5f17a690e0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 29 Dec 2015 15:24:39 +0100 Subject: ... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/satd-add.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/satd-add.c') diff --git a/src/satd-add.c b/src/satd-add.c index c3f19b6..90d445c 100644 --- a/src/satd-add.c +++ b/src/satd-add.c @@ -47,7 +47,6 @@ main(int argc, char *argv[]) /* Receive and validate message. */ t (readall(SOCK_FILENO, &message, &n)); - shutdown(SOCK_FILENO, SHUT_RD); t (n < sizeof(int) + sizeof(clockid_t) + sizeof(struct timespec)); n -= sizeof(int) + sizeof(clockid_t) + sizeof(struct timespec); msg_argc = *(int *)(message + n); @@ -63,11 +62,10 @@ main(int argc, char *argv[]) job->n = n; memcpy(job->payload, message, n); - /* Update state file. */ + /* Update state file and run hook. */ t (flock(STATE_FILENO, LOCK_EX)); t (fstat(STATE_FILENO, &attr)); - r = preadn(STATE_FILENO, &(job->no), sizeof(job->no), 0); - t (r < 0); + t (r = preadn(STATE_FILENO, &(job->no), sizeof(job->no), 0), r < 0); if (r < (ssize_t)sizeof(job->no)) job->no = 0; else @@ -78,6 +76,7 @@ main(int argc, char *argv[]) n += sizeof(*job); t (pwriten(STATE_FILENO, job, n, attr.st_size) < (ssize_t)n); fsync(STATE_FILENO); + run_job_or_hook(job, "queued"); t (flock(STATE_FILENO, LOCK_UN)); DAEMON_CLEANUP_START; -- cgit v1.2.3-70-g09d2