From 5b8a66fc23ad54a680b8bd9a0bb673ab048c365d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 8 Sep 2014 15:10:44 +0200 Subject: never volatile int, always volatile sig_atomic_t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-registry/slave.c | 9 +++++---- src/mds-registry/slave.h | 3 ++- src/mds-vt.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mds-registry/slave.c b/src/mds-registry/slave.c index f98dc20..bda6ca6 100644 --- a/src/mds-registry/slave.c +++ b/src/mds-registry/slave.c @@ -345,10 +345,11 @@ void slave_destroy(slave_t* restrict this) */ size_t slave_marshal_size(const slave_t* restrict this) { - size_t rc = 2 * sizeof(int) + sizeof(ssize_t) + sizeof(size_t) + sizeof(uint64_t); + size_t rc; hash_entry_t* restrict entry; size_t n; + rc = sizeof(int) + sizeof(sig_atomic_t) + sizeof(ssize_t) + sizeof(size_t) + sizeof(uint64_t); rc += sizeof(int) + sizeof(time_t) + sizeof(long); rc += (strlen(this->client_id) + strlen(this->message_id) + 2) * sizeof(char); @@ -375,7 +376,7 @@ size_t slave_marshal(const slave_t* restrict this, char* restrict data) size_t n; buf_set_next(data, int, SLAVE_T_VERSION); - buf_set_next(data, int, this->closed); + buf_set_next(data, sig_atomic_t, this->closed); buf_set_next(data, ssize_t, this->node); buf_set_next(data, uint64_t, this->client); buf_set_next(data, int, this->timed); @@ -422,7 +423,7 @@ size_t slave_unmarshal(slave_t* restrict this, char* restrict data) /* buf_get_next(data, int, SLAVE_T_VERSION); */ buf_next(data, int, 1); - buf_get_next(data, int, this->closed); + buf_get_next(data, sig_atomic_t, this->closed); buf_get_next(data, ssize_t, this->node); buf_get_next(data, uint64_t, this->client); buf_get_next(data, int, this->timed); @@ -483,7 +484,7 @@ size_t slave_unmarshal_skip(char* restrict data) /* buf_get_next(data, int, SLAVE_T_VERSION); */ buf_next(data, int, 1); - buf_next(data, int, 1); + buf_next(data, sig_atomic_t, 1); buf_next(data, ssize_t, 1); buf_next(data, uint64_t, 1); buf_next(data, int, 1); diff --git a/src/mds-registry/slave.h b/src/mds-registry/slave.h index 9f08f07..cb30b94 100644 --- a/src/mds-registry/slave.h +++ b/src/mds-registry/slave.h @@ -25,6 +25,7 @@ #include #include #include +#include @@ -63,7 +64,7 @@ typedef struct slave /** * Whether the client has been closed */ - volatile int closed; + volatile sig_atomic_t closed; /** * The slave thread diff --git a/src/mds-vt.c b/src/mds-vt.c index aed3805..dd30b46 100644 --- a/src/mds-vt.c +++ b/src/mds-vt.c @@ -97,7 +97,7 @@ static struct stat old_vt_stat; /** * -1 if switching to our VT, 1 if switching to another VT, 0 otherwise */ -static volatile int switching_vt = 0; +static volatile sig_atomic_t switching_vt = 0; /** * The pathname for the file containing VT information -- cgit v1.2.3-70-g09d2