aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-09-08 15:10:44 +0200
committerMattias Andrée <maandree@operamail.com>2014-09-08 15:10:44 +0200
commit5b8a66fc23ad54a680b8bd9a0bb673ab048c365d (patch)
treec6b15675089d850e27fb66189a7cc4a4b5abcc08 /src
parentmds-registry: take care of danger (diff)
downloadmds-5b8a66fc23ad54a680b8bd9a0bb673ab048c365d.tar.gz
mds-5b8a66fc23ad54a680b8bd9a0bb673ab048c365d.tar.bz2
mds-5b8a66fc23ad54a680b8bd9a0bb673ab048c365d.tar.xz
never volatile int, always volatile sig_atomic_t
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/mds-registry/slave.c9
-rw-r--r--src/mds-registry/slave.h3
-rw-r--r--src/mds-vt.c2
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 <stdint.h>
#include <pthread.h>
#include <time.h>
+#include <signal.h>
@@ -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