commit db239c9450031e7ee393f0466f490a85eeecbd08
parent eb357ded63789183423e7c3af25ee9805cb4ba12
Author: Friedel Schön <[email protected]>
Date: Wed, 10 May 2023 22:37:22 +0200
make everything -std=gnu99 conform
Diffstat:
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile
@@ -9,7 +9,7 @@ ROFF_DIR := man
# Compiler Options
CC ?= gcc
-CFLAGS ?= -Wall -Wextra -g
+CFLAGS ?= -g -std=gnu99 -pedantic
LDFLAGS ?= -fPIE
# Executable-specific flags
diff --git a/src/exec/sigremap.c b/src/exec/sigremap.c
@@ -63,13 +63,13 @@
// Indices are one-indexed (signal 1 is at index 1). Index zero is unused.
// User-specified signal rewriting.
-int signal_remap[MAXSIG + 1] = { [0 ... MAXSIG] = -1 };
+int signal_remap[MAXSIG + 1];
// One-time ignores due to TTY quirks. 0 = no skip, 1 = skip the next-received signal.
-bool signal_temporary_ignores[MAXSIG + 1] = { [0 ... MAXSIG] = false };
+bool signal_temporary_ignores[MAXSIG + 1];
-pid_t child_pid = -1;
-bool debug = false;
-bool use_setsid = true;
+int child_pid = -1;
+bool debug = false;
+bool use_setsid = true;
void forward_signal(int signum) {
if (signum >= 0 && signum <= MAXSIG && signal_remap[signum] != -1) {
@@ -113,8 +113,8 @@ void handle_signal(int signum) {
DEBUG("Ignoring tty hand-off signal %d.\n", signum);
signal_temporary_ignores[signum] = 0;
} else if (signum == SIGCHLD) {
- int status, exit_status;
- pid_t killed_pid;
+ int status, exit_status;
+ int killed_pid;
while ((killed_pid = waitpid(-1, &status, WNOHANG)) > 0) {
if (WIFEXITED(status)) {
exit_status = WEXITSTATUS(status);
@@ -224,6 +224,9 @@ int main(int argc, char* argv[]) {
sigprocmask(SIG_BLOCK, &all_signals, NULL);
for (int i = 1; i <= MAXSIG; i++) {
+ signal_remap[i] = -1;
+ signal_temporary_ignores[i] = false;
+
signal(i, dummy);
}
diff --git a/src/exec/vlogger.c b/src/exec/vlogger.c
@@ -151,12 +151,12 @@ int main(int argc, char* argv[]) {
if (ident->value == facility)
sfacility = ident->name;
}
- execl("/etc/vlogger", argv0, tag ?: "", slevel, sfacility, NULL);
+ execl("/etc/vlogger", argv0, tag ? tag : "", slevel, sfacility, NULL);
print_error("error: unable to exec /etc/vlogger: %s\n");
exit(1);
}
- openlog(tag ?: getlogin(), logflags, facility);
+ openlog(tag ? tag : getlogin(), logflags, facility);
if (argc > 0) {
size_t len;
diff --git a/src/restart.c b/src/restart.c
@@ -12,7 +12,7 @@
static void do_finish(service_t* s) {
struct stat st;
- if (fstatat(s->dir, "finish", &st, 0) != -1 && st.st_mode & S_IEXEC) {
+ if (fstatat(s->dir, "finish", &st, 0) != -1 && st.st_mode & S_IXUSR) {
s->state = STATE_FINISHING;
if ((s->pid = fork_dup_cd_exec(s->dir, "./finish", null_fd, null_fd, null_fd)) == -1) {
print_error("error: cannot execute ./finish: %s\n");