Fix minor compiler warnings

Fix a lot of minor compiler warnings with no practical effect.
Contributed by Sami Kerola.
This commit is contained in:
Marco d'Itri 2017-02-26 23:12:47 +01:00
parent a4815eb370
commit 5e33209e13
3 changed files with 11 additions and 8 deletions

View File

@ -151,7 +151,7 @@ int main(int argc, char *argv[])
/* prepend options from environment */
argv = merge_args(getenv("MKPASSWD_OPTIONS"), argv, &argc);
while ((ch = GETOPT_LONGISH(argc, argv, "hH:m:5P:R:sS:V", longopts, 0))
while ((ch = GETOPT_LONGISH(argc, argv, "hH:m:5P:R:sS:V", longopts, NULL))
> 0) {
switch (ch) {
case '5':
@ -364,7 +364,8 @@ int main(int argc, char *argv[])
void* get_random_bytes(const unsigned int count)
{
char *buf;
int fd, bytes_read;
int fd;
ssize_t bytes_read;
buf = NOFAIL(malloc(count));
fd = open(RANDOM_DEVICE, O_RDONLY);

View File

@ -46,7 +46,8 @@ char **merge_args(char *args, char *argv[], int *argc)
{
char *arg, *argstring;
char **newargs = NULL;
unsigned int i, num_env = 0;
int i;
unsigned int num_env = 0;
if (!args)
return argv;

11
whois.c
View File

@ -126,7 +126,8 @@ int main(int argc, char *argv[])
int longindex;
#endif
int ch, nopar = 0, fstringlen = 64;
int ch, nopar = 0;
size_t fstringlen = 64;
const char *server = NULL, *port = NULL;
char *qstring, *fstring;
int ret;
@ -1133,7 +1134,7 @@ const char *is_new_gtld(const char *s)
if (in_domain(s, new_gtlds[i]))
return new_gtlds[i];
return 0;
return NULL;
}
/*
@ -1232,7 +1233,7 @@ void split_server_port(const char *const input,
}
/* change the server name to lower case */
for (p = (char *) *server; *p && *p != '\0'; p++)
for (p = (char *) *server; *p; p++)
*p = tolower(*p);
}
@ -1268,7 +1269,7 @@ char *convert_6to4(const char *s)
}
new = malloc(sizeof("255.255.255.255"));
sprintf(new, "%d.%d.%d.%d", a >> 8, a & 0xff, b >> 8, b & 0xff);
sprintf(new, "%ud.%ud.%ud.%ud", a >> 8, a & 0xff, b >> 8, b & 0xff);
#endif
return new;
@ -1298,7 +1299,7 @@ char *convert_teredo(const char *s)
a ^= 0xffff;
b ^= 0xffff;
new = malloc(sizeof("255.255.255.255"));
sprintf(new, "%d.%d.%d.%d", a >> 8, a & 0xff, b >> 8, b & 0xff);
sprintf(new, "%ud.%ud.%ud.%ud", a >> 8, a & 0xff, b >> 8, b & 0xff);
#endif
return new;