diff options
| author | Mattias Andrée <maandree@operamail.com> | 2014-10-29 21:02:44 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2014-10-29 21:02:44 +0100 |
| commit | ab5184c275a05a6e6db6c95d4055b416fda4061c (patch) | |
| tree | 2d5dbf63a6f7d029fac720833f730bc0e5f8ae71 | |
| parent | add deps (diff) | |
| download | cerberus-logging-ab5184c275a05a6e6db6c95d4055b416fda4061c.tar.gz cerberus-logging-ab5184c275a05a6e6db6c95d4055b416fda4061c.tar.bz2 cerberus-logging-ab5184c275a05a6e6db6c95d4055b416fda4061c.tar.xz | |
fix warnings
Signed-off-by: Mattias Andrée <maandree@operamail.com>
| -rw-r--r-- | DEPENDENCIES | 2 | ||||
| -rw-r--r-- | src/common.h | 17 | ||||
| -rw-r--r-- | src/log-login-btmp.c | 4 | ||||
| -rw-r--r-- | src/log-login-lastlog.c | 2 | ||||
| -rw-r--r-- | src/log-login-utmp.c | 4 |
5 files changed, 18 insertions, 11 deletions
diff --git a/DEPENDENCIES b/DEPENDENCIES index 7eb3b68..707cee8 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -11,7 +11,7 @@ BUILD DEPENDENCIES: coreutils make - c99 (opt-out, for all log-login-*) + gcc (opt-out, for all log-login-*) libc (opt-out, for all log-login-*) audit (opt-out, for log-login-audit) diff --git a/src/common.h b/src/common.h index 5bcc315..09312e9 100644 --- a/src/common.h +++ b/src/common.h @@ -32,6 +32,13 @@ +#ifdef __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-function" +#endif + + + #ifndef VARDIR #define VARDIR "/var" #endif @@ -41,13 +48,13 @@ /* ttyname is defined in <unistd.h> */ -#define ttyname tty +#define ttyname ttyname_ #define LIST_ARGUMENTS X(action) X(username) X(ttyname) X(pid) X(hostname) #define streq(a, b) (((a == NULL) == (b == NULL)) || (a && b && !strcmp(a, b))) #define xstrcpy(d, s) (s ? snprintf(d, sizeof(d) / sizeof(char), "%s", s) : 0) -#define xmemcpy(d, s) (s ? memcpy(d, s, sizeof(d)) : 0) +#define xmemcpy(d, s) (s ? memcpy(d, s, sizeof(d)) : NULL) @@ -65,20 +72,20 @@ static inline const char* first_digit(const char* str) } -static inline const char* get_hostaddress(const char* hostname) +static const char* get_hostaddress(const char* host) { static char rc[32 * 4 / 8]; struct addrinfo hints; struct addrinfo *info = NULL; - if (hostname == NULL) + if (host == NULL) return NULL; memset(rc, 0, sizeof(rc)); memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_ADDRCONFIG; - if (getaddrinfo(hostname, NULL, &hints, &info)) return NULL; + if (getaddrinfo(host, NULL, &hints, &info)) return NULL; if (info == NULL) return NULL; if (info->ai_family == AF_INET) diff --git a/src/log-login-btmp.c b/src/log-login-btmp.c index 6d4ae18..c486193 100644 --- a/src/log-login-btmp.c +++ b/src/log-login-btmp.c @@ -41,8 +41,8 @@ int do_log(void) { struct timeval tv; gettimeofday(&tv, NULL); - ut.ut_tv.tv_sec = tv.tv_sec; - ut.ut_tv.tv_usec = tv.tv_usec; + ut.ut_tv.tv_sec = (typeof(ut.ut_tv.tv_sec))(tv.tv_sec); + ut.ut_tv.tv_usec = (typeof(ut.ut_tv.tv_usec))(tv.tv_usec); } #else { diff --git a/src/log-login-lastlog.c b/src/log-login-lastlog.c index fd0b617..1831b1e 100644 --- a/src/log-login-lastlog.c +++ b/src/log-login-lastlog.c @@ -37,7 +37,7 @@ int do_log(void) memset(&ll, 0, sizeof(ll)); - time(&t), ll.ll_time = t; + time(&t), ll.ll_time = (typeof(ll.ll_time))t; xstrcpy(ll.ll_line, ttyname); xstrcpy(ll.ll_host, hostname); diff --git a/src/log-login-utmp.c b/src/log-login-utmp.c index 1325bed..ed52a80 100644 --- a/src/log-login-utmp.c +++ b/src/log-login-utmp.c @@ -72,8 +72,8 @@ int do_log(void) { struct timeval tv; gettimeofday(&tv, NULL); - ut.ut_tv.tv_sec = tv.tv_sec; - ut.ut_tv.tv_usec = tv.tv_usec; + ut.ut_tv.tv_sec = (typeof(ut.ut_tv.tv_sec))(tv.tv_sec); + ut.ut_tv.tv_usec = (typeof(ut.ut_tv.tv_usec))(tv.tv_usec); } #else { |
