Fix warnings and bump WARNS to 6

- Staticize variables as needed
- Garbage collect argc/argv
- Fix -Wsign-compare warnings by casting small sizeof to (int)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
ngie 2015-04-11 03:38:49 +00:00
parent 93d332ff6f
commit 1add384e4d
2 changed files with 6 additions and 6 deletions

View File

@ -2,6 +2,6 @@
PROG= unix_bindconnect
MAN=
WARNS?= 2
WARNS?= 6
.include <bsd.prog.mk>

View File

@ -54,8 +54,8 @@
#define UNWIND_MAX 1024
int unwind_len;
struct unwind {
static int unwind_len;
static struct unwind {
char u_path[PATH_MAX];
} unwind_list[UNWIND_MAX];
@ -105,7 +105,7 @@ bind_test(const char *directory_path)
sun.sun_len = sizeof(sun);
sun.sun_family = AF_UNIX;
if (snprintf(sun.sun_path, sizeof(sun.sun_path), "%s", socket_path)
>= sizeof(sun.sun_path)) {
>= (int)sizeof(sun.sun_path)) {
warn("bind_test: snprintf(sun.sun_path)");
close(sock1);
return (-1);
@ -216,7 +216,7 @@ connect_test(const char *directory_path)
sun.sun_len = sizeof(sun);
sun.sun_family = AF_UNIX;
if (snprintf(sun.sun_path, sizeof(sun.sun_path), "%s", socket_path)
>= sizeof(sun.sun_path)) {
>= (int)sizeof(sun.sun_path)) {
warn("connect_test: snprintf(sun.sun_path)");
close(sock1);
return (-1);
@ -298,7 +298,7 @@ connect_test(const char *directory_path)
return (0);
}
int
main(int argc, char *argv[])
main(void)
{
char directory_path[PATH_MAX];
int error;