aboutsummaryrefslogtreecommitdiffstats
path: root/src/satd-add.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-29 15:24:39 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-29 15:24:39 +0100
commit4cc637948552123652d0546d8b93cf5f17a690e0 (patch)
treef8e6cd717ea8c46cc6e26c2c76e7d087397321cf /src/satd-add.c
parentreceive messsage from daemon (diff)
downloadsat-4cc637948552123652d0546d8b93cf5f17a690e0.tar.gz
sat-4cc637948552123652d0546d8b93cf5f17a690e0.tar.bz2
sat-4cc637948552123652d0546d8b93cf5f17a690e0.tar.xz
...
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r--src/satd-add.c7
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;