diff --git a/arguments.c b/arguments.c index ca6cc760..05ff97eb 100644 --- a/arguments.c +++ b/arguments.c @@ -18,6 +18,7 @@ #include <sys/types.h> +#include <getopt.h> #include <stdlib.h> #include <string.h> #include <unistd.h> diff --git a/client.c b/client.c index a790f32e..5458dfc9 100644 --- a/client.c +++ b/client.c @@ -26,6 +26,7 @@ #include <errno.h> #include <event.h> #include <fcntl.h> +#include <signal.h> #include <stdlib.h> #include <string.h> #include <unistd.h> diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c index 7f764670..0bf58449 100644 --- a/cmd-confirm-before.c +++ b/cmd-confirm-before.c @@ -16,6 +16,8 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <sys/types.h> + #include <ctype.h> #include <stdlib.h> #include <string.h> diff --git a/cmd-list-keys.c b/cmd-list-keys.c index 6fbaf14d..0733ee28 100644 --- a/cmd-list-keys.c +++ b/cmd-list-keys.c @@ -165,7 +165,7 @@ enum cmd_retval cmd_list_keys_commands(unused struct cmd *self, struct cmd_q *cmdq) { const struct cmd_entry **entryp; - struct cmd_entry *entry; + const struct cmd_entry *entry; for (entryp = cmd_table; *entryp != NULL; entryp++) { entry = *entryp; diff --git a/job.c b/job.c index a8e6d33a..c04a70b0 100644 --- a/job.c +++ b/job.c @@ -21,6 +21,7 @@ #include <fcntl.h> #include <paths.h> +#include <signal.h> #include <stdlib.h> #include <string.h> #include <unistd.h> diff --git a/screen.c b/screen.c index e5550222..5ef18a27 100644 --- a/screen.c +++ b/screen.c @@ -31,12 +31,12 @@ void screen_resize_y(struct screen *, u_int); void screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit) { - char hn[MAXHOSTNAMELEN]; + char host[HOST_NAME_MAX]; s->grid = grid_create(sx, sy, hlimit); - if (gethostname(hn, MAXHOSTNAMELEN) == 0) - s->title = xstrdup(hn); + if (gethostname(host, HOST_NAME_MAX) == 0) + s->title = xstrdup(host); else s->title = xstrdup(""); diff --git a/server-fn.c b/server-fn.c index 5b25c925..310f16e6 100644 --- a/server-fn.c +++ b/server-fn.c @@ -31,7 +31,7 @@ void server_callback_identify(int, short, void *); void server_fill_environ(struct session *s, struct environ *env) { - char var[MAXPATHLEN], *term; + char var[PATH_MAX], *term; u_int idx; long pid; diff --git a/signal.c b/signal.c index f9546dc5..7e6268a7 100644 --- a/signal.c +++ b/signal.c @@ -17,6 +17,8 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <sys/types.h> + #include <string.h> #include <signal.h> diff --git a/style.c b/style.c index 2a049fb6..6df2ed04 100644 --- a/style.c +++ b/style.c @@ -17,6 +17,8 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <sys/types.h> + #include <string.h> #include "tmux.h" diff --git a/tmux.c b/tmux.c index fd2d5173..fabcee52 100644 --- a/tmux.c +++ b/tmux.c @@ -22,6 +22,7 @@ #include <errno.h> #include <event.h> #include <fcntl.h> +#include <getopt.h> #include <locale.h> #include <paths.h> #include <pwd.h> @@ -46,7 +47,7 @@ char *cfg_file; char *shell_cmd; int debug_level; time_t start_time; -char socket_path[MAXPATHLEN]; +char socket_path[PATH_MAX]; int login_shell; char *environ_path; @@ -124,7 +125,7 @@ areshell(const char *shell) char * makesocketpath(const char *label) { - char base[MAXPATHLEN], realbase[MAXPATHLEN], *path, *s; + char base[PATH_MAX], realbase[PATH_MAX], *path, *s; struct stat sb; u_int uid; @@ -202,7 +203,7 @@ int main(int argc, char **argv) { struct passwd *pw; - char *s, *path, *label, **var, tmp[MAXPATHLEN]; + char *s, *path, *label, **var, tmp[PATH_MAX]; char in[256]; const char *home; long long pid; diff --git a/tmux.h b/tmux.h index 0a677a38..2b2cd4a6 100644 --- a/tmux.h +++ b/tmux.h @@ -21,7 +21,6 @@ #define PROTOCOL_VERSION 8 -#include <sys/param.h> #include <sys/time.h> #include <sys/queue.h> #include <sys/tree.h> @@ -29,10 +28,8 @@ #include <bitstring.h> #include <event.h> -#include <getopt.h> #include <imsg.h> #include <limits.h> -#include <signal.h> #include <stdarg.h> #include <stdint.h> #include <stdio.h> @@ -1565,7 +1562,7 @@ extern char *cfg_file; extern char *shell_cmd; extern int debug_level; extern time_t start_time; -extern char socket_path[MAXPATHLEN]; +extern char socket_path[PATH_MAX]; extern int login_shell; extern char *environ_path; void logfile(const char *); diff --git a/xmalloc.c b/xmalloc.c index 49a0eff9..b7331ea0 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -16,10 +16,8 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <sys/param.h> +#include <sys/types.h> -#include <errno.h> -#include <libgen.h> #include <stdint.h> #include <stdlib.h> #include <string.h>