aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--src/cerberus.c15
-rw-r--r--src/login.c4
-rw-r--r--src/security.c4
4 files changed, 14 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 0883aed..2507ff9 100644
--- a/Makefile
+++ b/Makefile
@@ -53,12 +53,13 @@ VRB_CPPFLAGS = $(foreach D, $(VRB_DEFS), -D'$(D)=$($(D))') -DAUTH=$(auth_$(AUTH)
OPTIMISE = -Os
STD=gnu99
-WARN = -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs \
+WARN = -Wall -Wextra -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs \
-Wfloat-equal -Wmissing-prototypes -Wmissing-declarations -Wtrampolines -Wnested-externs \
-Wno-variadic-macros -Wdeclaration-after-statement -Wundef -Wpacked -Wunsafe-loop-optimizations \
-Wbad-function-cast -Wwrite-strings -Wlogical-op -Wstrict-prototypes -Wold-style-definition \
-Wvector-operation-performance -Wstack-protector -Wunsuffixed-float-constants -Wcast-align \
-Wsync-nand -Wshadow -Wredundant-decls -Winline -Wcast-qual -Wsign-conversion -Wstrict-overflow
+# excluded: -pedantic
CPPFLAGS = $(EXTRA_CPP_FLAGS) $(STR_CPPFLAGS) $(VRB_CPPFLAGS)
CFLAGS = -std=$(STD) $(WARN)
LDFLAGS =
diff --git a/src/cerberus.c b/src/cerberus.c
index 7bea9fc..49fbe66 100644
--- a/src/cerberus.c
+++ b/src/cerberus.c
@@ -181,16 +181,17 @@ void do_login(int argc, char** argv)
/* Only root may bypass authentication */
- if (skip_auth && getuid())
+ if (skip_auth)
{
- printf("%s: only root by use the -f option\n", *argv);
- sleep(ERROR_SLEEP);
- _exit(2);
+ if (getuid())
+ {
+ printf("%s: only root by use the -f option\n", *argv);
+ sleep(ERROR_SLEEP);
+ _exit(2);
+ }
}
-
-
/* Print ant we want a passphrase, if -f has not been used */
- if (skip_auth == 0)
+ else
{
printf("Passphrase: ");
fflush(stdout);
diff --git a/src/login.c b/src/login.c
index 32f118f..8bc5e05 100644
--- a/src/login.c
+++ b/src/login.c
@@ -99,7 +99,7 @@ void set_environ(struct passwd* entry, char preserve_env)
char* term = NULL;
if (_term)
{
- int n = 0, i;
+ size_t n = 0, i;
while (*(_term + n++))
;
term = malloc(n * sizeof(char));
@@ -146,7 +146,7 @@ void exec_shell(struct passwd* entry)
{
int child_argc = 0;
char** child_argv = malloc(5 * sizeof(char*));
- long n = 0;
+ size_t n = 0;
char* sh = entry->pw_shell;
char* login_sh;
diff --git a/src/security.c b/src/security.c
index 151a7a3..45feb66 100644
--- a/src/security.c
+++ b/src/security.c
@@ -33,7 +33,7 @@
#include "security.h"
-static inline void fail(char* str)
+static void fail(const char* str)
{
perror(str);
sleep(ERROR_SLEEP);
@@ -62,7 +62,7 @@ void secure_tty(gid_t group)
/* Kill other processes on this TTY */
tcgetattr(STDIN_FILENO, &tty);
saved_tty = tty;
- tty.c_cflag &= ~HUPCL;
+ tty.c_cflag &= (tcflag_t)~HUPCL;
tcsetattr(0, TCSANOW, &tty);
close(STDIN_FILENO);
close(STDOUT_FILENO);