mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Cleanup warnings
This commit is contained in:
parent
975f60d2ac
commit
7f26d860b5
@ -37,8 +37,8 @@ CFLAGS += -g
|
|||||||
CFLAGS += -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
|
CFLAGS += -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
|
||||||
CFLAGS += -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
|
CFLAGS += -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
|
||||||
CFLAGS += -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare
|
CFLAGS += -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare
|
||||||
CFLAGS += -Wundef -Wbad-function-cast -Winline -Wcast-align
|
CFLAGS += -Wundef -Wbad-function-cast -Winline
|
||||||
CFLAGS += -Wdeclaration-after-statement -Wno-pointer-sign -Wno-attributes
|
CFLAGS += -Wno-pointer-sign -Wno-attributes
|
||||||
CPPFLAGS += -DDEBUG
|
CPPFLAGS += -DDEBUG
|
||||||
endif
|
endif
|
||||||
if IS_COVERAGE
|
if IS_COVERAGE
|
||||||
@ -48,6 +48,9 @@ endif
|
|||||||
CPPFLAGS += -iquote.
|
CPPFLAGS += -iquote.
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CFLAGS += -Wno-unused-parameter -Wno-unused-variable -Wno-null-pointer-arithmetic
|
||||||
|
CFLAGS += -Wno-format-nonliteral
|
||||||
|
|
||||||
# Set flags for Solaris.
|
# Set flags for Solaris.
|
||||||
if IS_SUNOS
|
if IS_SUNOS
|
||||||
if IS_GCC
|
if IS_GCC
|
||||||
|
@ -52,6 +52,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "compat.h"
|
||||||
|
|
||||||
#define Assert(Cond) if (!(Cond)) abort()
|
#define Assert(Cond) if (!(Cond)) abort()
|
||||||
|
|
||||||
static const char Base64[] =
|
static const char Base64[] =
|
||||||
@ -122,7 +124,7 @@ static const char Pad64 = '=';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) {
|
b64_ntop(const char *src, size_t srclength, char *target, size_t targsize) {
|
||||||
size_t datalength = 0;
|
size_t datalength = 0;
|
||||||
uint8_t input[3];
|
uint8_t input[3];
|
||||||
uint8_t output[4];
|
uint8_t output[4];
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
AC_INIT(tmate-ssh-server, 2.3.0)
|
AC_INIT(tmate-ssh-server, 2.3.0)
|
||||||
|
|
||||||
|
AM_SILENT_RULES([yes])
|
||||||
AC_CONFIG_AUX_DIR(etc)
|
AC_CONFIG_AUX_DIR(etc)
|
||||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||||
|
|
||||||
|
13
log.c
13
log.c
@ -81,6 +81,7 @@ void init_logging(const char *program_name, bool use_syslog, int log_level)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Write a log message. */
|
/* Write a log message. */
|
||||||
|
__attribute__((__format__(__printf__, 2, 0)))
|
||||||
static void
|
static void
|
||||||
log_vwrite(int level, const char *msg, va_list ap)
|
log_vwrite(int level, const char *msg, va_list ap)
|
||||||
{
|
{
|
||||||
@ -121,6 +122,7 @@ log_debug(const char *msg, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Log a critical error with error string and die. */
|
/* Log a critical error with error string and die. */
|
||||||
|
__attribute__((__format__(__printf__, 1, 0)))
|
||||||
__dead void
|
__dead void
|
||||||
fatal(const char *msg, ...)
|
fatal(const char *msg, ...)
|
||||||
{
|
{
|
||||||
@ -130,11 +132,13 @@ fatal(const char *msg, ...)
|
|||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
if (asprintf(&fmt, "fatal: %s: %s", msg, strerror(errno)) == -1)
|
if (asprintf(&fmt, "fatal: %s: %s", msg, strerror(errno)) == -1)
|
||||||
exit(1);
|
exit(1);
|
||||||
log_vwrite(LOG_CRIT, fmt, ap);
|
msg = fmt;
|
||||||
|
log_vwrite(LOG_CRIT, msg, ap);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Log a critical error and die. */
|
/* Log a critical error and die. */
|
||||||
|
__attribute__((__format__(__printf__, 1, 0)))
|
||||||
__dead void
|
__dead void
|
||||||
fatalx(const char *msg, ...)
|
fatalx(const char *msg, ...)
|
||||||
{
|
{
|
||||||
@ -144,10 +148,12 @@ fatalx(const char *msg, ...)
|
|||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
if (asprintf(&fmt, "fatal: %s", msg) == -1)
|
if (asprintf(&fmt, "fatal: %s", msg) == -1)
|
||||||
exit(1);
|
exit(1);
|
||||||
log_vwrite(LOG_CRIT, fmt, ap);
|
msg = fmt;
|
||||||
|
log_vwrite(LOG_CRIT, msg, ap);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__attribute__((__format__(__printf__, 2, 0)))
|
||||||
void tmate_log(int level, const char *msg, ...)
|
void tmate_log(int level, const char *msg, ...)
|
||||||
{
|
{
|
||||||
char *fmt;
|
char *fmt;
|
||||||
@ -160,7 +166,8 @@ void tmate_log(int level, const char *msg, ...)
|
|||||||
|
|
||||||
if (asprintf(&fmt, "(tmate) %s", msg) < 0)
|
if (asprintf(&fmt, "(tmate) %s", msg) < 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
log_vwrite(level, fmt, ap);
|
msg = fmt;
|
||||||
|
log_vwrite(level, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
free(fmt);
|
free(fmt);
|
||||||
|
@ -28,7 +28,9 @@ char *osdep_get_name(int, char *);
|
|||||||
char *osdep_get_cwd(int);
|
char *osdep_get_cwd(int);
|
||||||
struct event_base *osdep_event_init(void);
|
struct event_base *osdep_event_init(void);
|
||||||
|
|
||||||
|
#ifndef __unused
|
||||||
#define __unused __attribute__ ((__unused__))
|
#define __unused __attribute__ ((__unused__))
|
||||||
|
#endif
|
||||||
|
|
||||||
char *
|
char *
|
||||||
osdep_get_name(int fd, __unused char *tty)
|
osdep_get_name(int fd, __unused char *tty)
|
||||||
|
2
proc.c
2
proc.c
@ -100,6 +100,7 @@ proc_event_cb(__unused int fd, short events, void *arg)
|
|||||||
proc_update_event(peer);
|
proc_update_event(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TMATE
|
||||||
static void
|
static void
|
||||||
proc_signal_cb(int signo, __unused short events, void *arg)
|
proc_signal_cb(int signo, __unused short events, void *arg)
|
||||||
{
|
{
|
||||||
@ -107,6 +108,7 @@ proc_signal_cb(int signo, __unused short events, void *arg)
|
|||||||
|
|
||||||
tp->signalcb(signo);
|
tp->signalcb(signo);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
peer_check_version(struct tmuxpeer *peer, struct imsg *imsg)
|
peer_check_version(struct tmuxpeer *peer, struct imsg *imsg)
|
||||||
|
@ -564,6 +564,7 @@ session_group_index(struct session_group *sg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fatalx("session group not found");
|
fatalx("session group not found");
|
||||||
|
for(;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "tmate.h"
|
#include "tmate.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
struct tmate_session _tmate_session, *tmate_session = &_tmate_session;
|
struct tmate_session _tmate_session, *tmate_session = &_tmate_session;
|
||||||
|
|
||||||
|
@ -339,10 +339,8 @@ static int get_client_ip_proxy_protocol(int fd, char *dst, size_t len)
|
|||||||
|
|
||||||
tok_num = 0;
|
tok_num = 0;
|
||||||
for (char *tok = strtok(header, " "); tok; tok = strtok(NULL, " "), tok_num++) {
|
for (char *tok = strtok(header, " "); tok; tok = strtok(NULL, " "), tok_num++) {
|
||||||
if (tok_num == 1) {
|
if (tok_num == 1)
|
||||||
strncpy(dst, tok, len);
|
strlcpy(dst, tok, len);
|
||||||
dst[len-1] = '\0';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok_num != 5)
|
if (tok_num != 5)
|
||||||
|
@ -94,6 +94,7 @@ xasprintf(char **ret, const char *fmt, ...)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__attribute__((__format__(__printf__, 2, 0)))
|
||||||
int
|
int
|
||||||
xvasprintf(char **ret, const char *fmt, va_list ap)
|
xvasprintf(char **ret, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
@ -120,6 +121,7 @@ xsnprintf(char *str, size_t len, const char *fmt, ...)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__attribute__((__format__(__printf__, 3, 0)))
|
||||||
int
|
int
|
||||||
xvsnprintf(char *str, size_t len, const char *fmt, va_list ap)
|
xvsnprintf(char *str, size_t len, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user