diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-10-20 20:51:04 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-10-20 20:51:04 -0700 |
commit | eb6b20a502f7c20b6a5cfc9155dcbf2cb06c895e (patch) | |
tree | 33b22a385cc93d255883b403947007f24ec20180 | |
parent | ca9d41f19051d34bad12ea3b703ae20ba1902773 (diff) | |
download | txr-eb6b20a502f7c20b6a5cfc9155dcbf2cb06c895e.tar.gz txr-eb6b20a502f7c20b6a5cfc9155dcbf2cb06c895e.tar.bz2 txr-eb6b20a502f7c20b6a5cfc9155dcbf2cb06c895e.zip |
A few volatile fixes related to setjmp.
* socket.c (dgram_get_byte_callback): nbytes must be volatile
because we assign to it after setting up the catch, and then
access it in the unwind code.
(sock_accept): Likewise.
* stream.c (generic_get_line): buf variable must be volatile.
(struct save_fds): The members of this structure must
be volatile; it's used as a local variable in a number of
functions in a way that requires volatile.
-rw-r--r-- | socket.c | 4 | ||||
-rw-r--r-- | stream.c | 8 |
2 files changed, 6 insertions, 6 deletions
@@ -408,7 +408,7 @@ static int dgram_get_byte_callback(mem_t *ctx) } else { const int dgram_size = d->rx_max; mem_t *dgram = chk_malloc(dgram_size); - ssize_t nbytes = -1; + volatile ssize_t nbytes = -1; uw_simple_catch_begin; @@ -895,7 +895,7 @@ static val sock_accept(val sock, val mode_str, val timeout_in) if (type == num_fast(SOCK_DGRAM)) { struct dgram_stream *d = coerce(struct dgram_stream *, sock->co.handle); - ssize_t nbytes = -1; + volatile ssize_t nbytes = -1; const int dgram_size = d->rx_max; mem_t *dgram = chk_malloc(dgram_size); @@ -691,7 +691,7 @@ val generic_get_line(val stream) const size_t min_size = 512; size_t size = 0; size_t fill = 0; - wchar_t *buf = 0; + wchar_t *volatile buf = 0; val out = nil; uw_simple_catch_begin; @@ -3650,9 +3650,9 @@ val open_tail(val path, val mode_str, val seek_end_p) } struct save_fds { - int in; - int out; - int err; + volatile int in; + volatile int out; + volatile int err; }; #define FDS_IN 1 |