summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-12-04 21:34:14 +0100
committerDaniel Friesel <derf@finalrewind.org>2018-12-04 21:34:14 +0100
commitbafc47fd575bb7878214deda3730efcb6c755770 (patch)
tree2bfa39bf4febb59710f9b9c48f2e335627eb0251
parent3fc148aecf9a5334a26752acf6b6d71819cbc2f4 (diff)
Declare sig_exit as volatile
sig_exit may be changed by a signal handler, so its value should always be read from RAM.
-rw-r--r--src/filelist.c2
-rw-r--r--src/imlib.c2
-rw-r--r--src/signals.c2
-rw-r--r--src/signals.h2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/filelist.c b/src/filelist.c
index 3f3c96d..6f4f6df 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "feh.h"
#include "filelist.h"
+#include "signals.h"
#include "options.h"
gib_list *filelist = NULL;
@@ -37,7 +38,6 @@ gib_list *original_file_items = NULL; /* original file items from argv */
int filelist_len = 0;
gib_list *current_file = NULL;
extern int errno;
-extern int sig_exit; /* exit flag from signal handler */
static gib_list *rm_filelist = NULL;
diff --git a/src/imlib.c b/src/imlib.c
index 3bc0126..4d2f2fa 100644
--- a/src/imlib.c
+++ b/src/imlib.c
@@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "feh.h"
#include "filelist.h"
+#include "signals.h"
#include "winwidget.h"
#include "options.h"
@@ -37,7 +38,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef HAVE_LIBCURL
#include <curl/curl.h>
-extern int sig_exit;
#endif
#ifdef HAVE_LIBEXIF
diff --git a/src/signals.c b/src/signals.c
index aeaf889..d65f49b 100644
--- a/src/signals.c
+++ b/src/signals.c
@@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "options.h"
void feh_handle_signal(int);
-int sig_exit = 0;
+volatile int sig_exit = 0;
void setup_signal_handlers()
{
diff --git a/src/signals.h b/src/signals.h
index 090ab0b..38fc0d2 100644
--- a/src/signals.h
+++ b/src/signals.h
@@ -27,5 +27,5 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SIGNALS_H
void setup_signal_handlers();
-extern int sig_exit;
+volatile extern int sig_exit;
#endif