diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-29 00:59:19 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-29 00:59:19 +0100 |
commit | d679ea3129781ef564c1f91194104ce7692bb102 (patch) | |
tree | 966f69d63bd1c5b1229aa99ee4378e6e0f50e74d /src/satd-add.c | |
parent | reopen state file, we will use flock on it, so all processes need their own open file descriptor for it (diff) | |
download | sat-d679ea3129781ef564c1f91194104ce7692bb102.tar.gz sat-d679ea3129781ef564c1f91194104ce7692bb102.tar.bz2 sat-d679ea3129781ef564c1f91194104ce7692bb102.tar.xz |
fix errors
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src/satd-add.c')
-rw-r--r-- | src/satd-add.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/satd-add.c b/src/satd-add.c index 497e32d..0d7d777 100644 --- a/src/satd-add.c +++ b/src/satd-add.c @@ -39,22 +39,26 @@ main(int argc, char *argv[]) size_t n = 0, elements = 0, i; char *message = NULL; int msg_argc; - char **msg = NULL; - t (reopen(STATE_FILENO, O_RDRW)); + assert(argc == 4); + t (reopen(STATE_FILENO, O_RDWR)); /* Receive and validate message. */ t (readall(SOCK_FILENO, &message, &n)); shutdown(SOCK_FILENO, SHUT_RD); - t (n < sizeof(int) + sizeof(clk) + sizeof(ts)); - n -= sizeof(int) + sizeof(clk) + sizeof(ts); + t (n < sizeof(int) + sizeof(clockid_t) + sizeof(struct timespec)); + n -= sizeof(int) + sizeof(clockid_t) + sizeof(struct timespec); msg_argc = *(int *)(message + n); t ((msg_argc < 1) || !n || message[n - 1]); for (i = n; i--; elements += !message[i]); t (elements < (size_t)msg_argc); - n += sizeof(int) + sizeof(clk) + sizeof(ts); + n += sizeof(int) + sizeof(clockid_t) + sizeof(struct timespec); + + (void) argv; return 0; fail: + + (void) argc; } |