diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-29 15:24:39 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-29 15:24:39 +0100 |
commit | 4cc637948552123652d0546d8b93cf5f17a690e0 (patch) | |
tree | f8e6cd717ea8c46cc6e26c2c76e7d087397321cf /src/satd-add.c | |
parent | receive messsage from daemon (diff) | |
download | sat-4cc637948552123652d0546d8b93cf5f17a690e0.tar.gz sat-4cc637948552123652d0546d8b93cf5f17a690e0.tar.bz2 sat-4cc637948552123652d0546d8b93cf5f17a690e0.tar.xz |
...
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src/satd-add.c')
-rw-r--r-- | src/satd-add.c | 7 |
1 files changed, 3 insertions, 4 deletions
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; |