mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-07 08:44:01 +01:00
Cleanup warnings
This commit is contained in:
parent
1600a81e58
commit
ba860b8f45
@ -33,8 +33,8 @@ CFLAGS += -g
|
||||
CFLAGS += -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
|
||||
CFLAGS += -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
|
||||
CFLAGS += -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare
|
||||
CFLAGS += -Wundef -Wbad-function-cast -Winline -Wcast-align
|
||||
CFLAGS += -Wdeclaration-after-statement -Wno-pointer-sign -Wno-attributes
|
||||
CFLAGS += -Wundef -Wbad-function-cast -Winline
|
||||
CFLAGS += -Wno-pointer-sign -Wno-attributes
|
||||
CPPFLAGS += -DDEBUG
|
||||
endif
|
||||
if IS_COVERAGE
|
||||
@ -44,6 +44,9 @@ endif
|
||||
CPPFLAGS += -iquote.
|
||||
endif
|
||||
|
||||
CFLAGS += -Wno-unused-parameter -Wno-unused-variable -Wno-null-pointer-arithmetic
|
||||
CFLAGS += -Wno-deprecated-declarations -Wno-format-nonliteral
|
||||
|
||||
# Set flags for Solaris.
|
||||
if IS_SUNOS
|
||||
if IS_GCC
|
||||
|
3
client.c
3
client.c
@ -241,9 +241,6 @@ int run_headless_command(int argc, const char **argv, int flags, void (*err_call
|
||||
return 0;
|
||||
|
||||
/* error messages land in cfg_causes */
|
||||
extern char **cfg_causes;
|
||||
extern u_int cfg_ncauses;
|
||||
|
||||
int ret = cfg_ncauses ? -1 : 0;
|
||||
for (u_int i = 0; i < cfg_ncauses; i++) {
|
||||
if (err_callback)
|
||||
|
@ -52,6 +52,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#define Assert(Cond) if (!(Cond)) abort()
|
||||
|
||||
static const char Base64[] =
|
||||
@ -122,7 +124,7 @@ static const char Pad64 = '=';
|
||||
*/
|
||||
|
||||
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;
|
||||
uint8_t input[3];
|
||||
uint8_t output[4];
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
AC_INIT(tmate, 2.3.1)
|
||||
|
||||
AM_SILENT_RULES([yes])
|
||||
AC_CONFIG_AUX_DIR(etc)
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
|
||||
|
9
log.c
9
log.c
@ -98,6 +98,7 @@ log_close(void)
|
||||
}
|
||||
|
||||
/* Write a log message. */
|
||||
__attribute__((__format__(__printf__, 1, 0)))
|
||||
static void
|
||||
log_vwrite(const char *msg, va_list ap)
|
||||
{
|
||||
@ -144,6 +145,7 @@ log_emit(int level, const char *msg, ...)
|
||||
}
|
||||
|
||||
/* Log a critical error with error string and die. */
|
||||
__attribute__((__format__(__printf__, 1, 0)))
|
||||
__dead void
|
||||
fatal(const char *msg, ...)
|
||||
{
|
||||
@ -153,11 +155,13 @@ fatal(const char *msg, ...)
|
||||
va_start(ap, msg);
|
||||
if (asprintf(&fmt, "fatal: %s: %s", msg, strerror(errno)) == -1)
|
||||
exit(1);
|
||||
log_vwrite(fmt, ap);
|
||||
msg = fmt;
|
||||
log_vwrite(msg, ap);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Log a critical error and die. */
|
||||
__attribute__((__format__(__printf__, 1, 0)))
|
||||
__dead void
|
||||
fatalx(const char *msg, ...)
|
||||
{
|
||||
@ -167,6 +171,7 @@ fatalx(const char *msg, ...)
|
||||
va_start(ap, msg);
|
||||
if (asprintf(&fmt, "fatal: %s", msg) == -1)
|
||||
exit(1);
|
||||
log_vwrite(fmt, ap);
|
||||
msg = fmt;
|
||||
log_vwrite(msg, ap);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -28,7 +28,9 @@ char *osdep_get_name(int, char *);
|
||||
char *osdep_get_cwd(int);
|
||||
struct event_base *osdep_event_init(void);
|
||||
|
||||
#ifndef __unused
|
||||
#define __unused __attribute__ ((__unused__))
|
||||
#endif
|
||||
|
||||
char *
|
||||
osdep_get_name(int fd, __unused char *tty)
|
||||
|
@ -278,7 +278,7 @@ screen_redraw_draw_borders(struct client *c, int status, u_int top)
|
||||
struct window *w = s->curw->window;
|
||||
struct options *oo = w->options;
|
||||
struct tty *tty = &c->tty;
|
||||
struct window_pane *wp;
|
||||
struct window_pane *wp = NULL;
|
||||
struct grid_cell m_active_gc, active_gc, m_other_gc, other_gc;
|
||||
struct grid_cell msg_gc;
|
||||
u_int i, j, type, msgx = 0, msgy = 0;
|
||||
|
@ -621,6 +621,7 @@ session_group_index(struct session_group *sg)
|
||||
}
|
||||
|
||||
fatalx("session group not found");
|
||||
for(;;);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -137,7 +137,7 @@ void tmate_session_init(struct event_base *base)
|
||||
tmate_write_header();
|
||||
}
|
||||
|
||||
static void send_authorized_keys()
|
||||
static void send_authorized_keys(void)
|
||||
{
|
||||
char *path;
|
||||
path = options_get_string(global_options, "tmate-authorized-keys");
|
||||
|
@ -115,7 +115,7 @@ static int passphrase_callback(__unused const char *prompt, char *buf, size_t le
|
||||
client->tmate_session->need_passphrase = 1;
|
||||
|
||||
if (client->tmate_session->passphrase)
|
||||
strncpy(buf, client->tmate_session->passphrase, len);
|
||||
strlcpy(buf, client->tmate_session->passphrase, len);
|
||||
else
|
||||
strcpy(buf, "");
|
||||
|
||||
@ -268,7 +268,7 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
|
||||
}
|
||||
|
||||
client->state = SSH_CONNECT;
|
||||
/* fall through */
|
||||
// fall through
|
||||
|
||||
case SSH_CONNECT:
|
||||
switch (ssh_connect(session)) {
|
||||
@ -284,8 +284,8 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
|
||||
|
||||
tmate_debug("Establishing connection to %s", client->server_ip);
|
||||
client->state = SSH_AUTH_SERVER;
|
||||
/* fall through */
|
||||
}
|
||||
// fall through
|
||||
|
||||
case SSH_AUTH_SERVER:
|
||||
#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 9, 0)
|
||||
@ -352,7 +352,7 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
|
||||
on_ssh_auth_server_complete(client);
|
||||
|
||||
client->state = SSH_AUTH_CLIENT_NONE;
|
||||
/* fall through */
|
||||
// fall through
|
||||
|
||||
case SSH_AUTH_CLIENT_NONE:
|
||||
switch (ssh_userauth_none(session, NULL)) {
|
||||
@ -368,8 +368,8 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
|
||||
case SSH_AUTH_PARTIAL:
|
||||
case SSH_AUTH_DENIED:
|
||||
client->state = SSH_AUTH_CLIENT_PUBKEY;
|
||||
/* fall through */
|
||||
}
|
||||
// fall through
|
||||
|
||||
case SSH_AUTH_CLIENT_PUBKEY:
|
||||
client->tried_passphrase = client->tmate_session->passphrase;
|
||||
@ -397,8 +397,8 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
|
||||
case SSH_AUTH_SUCCESS:
|
||||
tmate_debug("Auth successful with pubkey");
|
||||
client->state = SSH_NEW_CHANNEL;
|
||||
/* fall through */
|
||||
}
|
||||
// fall through
|
||||
|
||||
SSH_NEW_CHANNEL:
|
||||
case SSH_NEW_CHANNEL:
|
||||
@ -408,6 +408,7 @@ SSH_NEW_CHANNEL:
|
||||
return;
|
||||
}
|
||||
client->state = SSH_OPEN_CHANNEL;
|
||||
// fall through
|
||||
|
||||
case SSH_OPEN_CHANNEL:
|
||||
switch (ssh_channel_open_session(channel)) {
|
||||
@ -420,8 +421,8 @@ SSH_NEW_CHANNEL:
|
||||
case SSH_OK:
|
||||
tmate_debug("Session opened, initalizing tmate");
|
||||
client->state = SSH_BOOTSTRAP;
|
||||
/* fall through */
|
||||
}
|
||||
// fall through
|
||||
|
||||
case SSH_BOOTSTRAP:
|
||||
switch (ssh_channel_request_subsystem(channel, "tmate")) {
|
||||
@ -449,9 +450,8 @@ SSH_NEW_CHANNEL:
|
||||
|
||||
free(client->tmate_session->last_server_ip);
|
||||
client->tmate_session->last_server_ip = xstrdup(client->server_ip);
|
||||
|
||||
/* fall through */
|
||||
}
|
||||
// fall through
|
||||
|
||||
case SSH_READY:
|
||||
read_channel(client);
|
||||
|
2
tmux.h
2
tmux.h
@ -1576,6 +1576,8 @@ void proc_kill_peer(struct tmuxpeer *);
|
||||
extern int cfg_finished;
|
||||
extern int cfg_references;
|
||||
extern struct client *cfg_client;
|
||||
extern char **cfg_causes;
|
||||
extern u_int cfg_ncauses;
|
||||
void start_cfg(void);
|
||||
int load_cfg(const char *, struct cmd_q *, char **);
|
||||
void set_cfg_file(const char *);
|
||||
|
@ -94,6 +94,7 @@ xasprintf(char **ret, const char *fmt, ...)
|
||||
return i;
|
||||
}
|
||||
|
||||
__attribute__((__format__(__printf__, 2, 0)))
|
||||
int
|
||||
xvasprintf(char **ret, const char *fmt, va_list ap)
|
||||
{
|
||||
@ -120,6 +121,7 @@ xsnprintf(char *str, size_t len, const char *fmt, ...)
|
||||
return i;
|
||||
}
|
||||
|
||||
__attribute__((__format__(__printf__, 3, 0)))
|
||||
int
|
||||
xvsnprintf(char *str, size_t len, const char *fmt, va_list ap)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user