Added volatile keyword

This commit is contained in:
2022-07-03 23:02:53 -05:00
parent 8ecd79ff40
commit 23be8915d6
4 changed files with 4 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ SRC = $(wildcard src/*.c)
OBJ = $(subst .c,.o,$(subst src,work,$(SRC))) OBJ = $(subst .c,.o,$(subst src,work,$(SRC)))
LIBS = gnutls LIBS = gnutls
LDFLAGS = -pie -lrt -ldl $(shell pkg-config --libs $(LIBS)) LDFLAGS = -pie -lrt -ldl $(shell pkg-config --libs $(LIBS))
CFLAGS := -O2 -pipe -Wall -Wpedantic -Wshadow -ansi -D_XOPEN_SOURCE=500 -ggdb CFLAGS := -O2 -pipe -Wall -Wpedantic -Wshadow -ansi -D_XOPEN_SOURCE=500
CFLAGS += -Isrc/ -fpie -D_POSIX_C_SOURCE=200809L $(shell pkg-config --cflags $(LIBS)) CFLAGS += -Isrc/ -fpie -D_POSIX_C_SOURCE=200809L $(shell pkg-config --cflags $(LIBS))
INSTALLDIR := /usr/sbin INSTALLDIR := /usr/sbin
HEADERDIR := /usr/include/ HEADERDIR := /usr/include/

View File

@@ -46,7 +46,7 @@ static int *pending;
static Sitefile *site; static Sitefile *site;
static int mainfd; /* fd of the UNIX socket */ static int mainfd; /* fd of the UNIX socket */
static struct sockaddr_un addr; static struct sockaddr_un addr;
static ConnInfo *conninfo; static volatile ConnInfo *conninfo;
/* We want to be able to handle a signal at any time, so some global variables /* We want to be able to handle a signal at any time, so some global variables
* are needed. */ * are needed. */
static const int signals[] = { static const int signals[] = {

View File

@@ -32,7 +32,7 @@
#include <swebs/connections.h> #include <swebs/connections.h>
void runServer(int connfd, Sitefile *site, int *pending, int id, void runServer(int connfd, Sitefile *site, int *pending, int id,
ConnInfo *conninfo) { volatile ConnInfo *conninfo) {
int allocConns = 100; int allocConns = 100;
struct pollfd *fds; struct pollfd *fds;
Connection *connections; Connection *connections;

View File

@@ -29,7 +29,7 @@ typedef struct {
} ConnInfo; } ConnInfo;
void runServer(int connfd, Sitefile *site, int *pending, int id, void runServer(int connfd, Sitefile *site, int *pending, int id,
ConnInfo *info); volatile ConnInfo *info);
/* pending and info are shared memory. pending[id] is the amount of connections /* pending and info are shared memory. pending[id] is the amount of connections
* that are being processed by that process, and info contains info about the * that are being processed by that process, and info contains info about the
* connection being sent through. */ * connection being sent through. */