mirror of
https://github.com/moparisthebest/sslh
synced 2024-11-24 18:12:17 -05:00
check asprintf return value
The current asprintf usage triggers many warnings like: sslh-main.c: In function 'print_usage': sslh-main.c:86:17: warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
b8ea0699c4
commit
2d23cdc9f4
4
common.c
4
common.c
@ -487,9 +487,11 @@ void setup_signals(void)
|
|||||||
* banner is made up of basename(bin_name)+"[pid]" */
|
* banner is made up of basename(bin_name)+"[pid]" */
|
||||||
void setup_syslog(const char* bin_name) {
|
void setup_syslog(const char* bin_name) {
|
||||||
char *name1, *name2;
|
char *name1, *name2;
|
||||||
|
int res;
|
||||||
|
|
||||||
name1 = strdup(bin_name);
|
name1 = strdup(bin_name);
|
||||||
asprintf(&name2, "%s[%d]", basename(name1), getpid());
|
res = asprintf(&name2, "%s[%d]", basename(name1), getpid());
|
||||||
|
CHECK_RES_DIE(res, "asprintf");
|
||||||
openlog(name2, LOG_CONS, LOG_AUTH);
|
openlog(name2, LOG_CONS, LOG_AUTH);
|
||||||
free(name1);
|
free(name1);
|
||||||
/* Don't free name2, as openlog(3) uses it (at least in glibc) */
|
/* Don't free name2, as openlog(3) uses it (at least in glibc) */
|
||||||
|
3
probe.c
3
probe.c
@ -63,7 +63,8 @@ int get_num_builtins(void) {
|
|||||||
/* Sets the protocol name to connect to in case of timeout */
|
/* Sets the protocol name to connect to in case of timeout */
|
||||||
void set_ontimeout(const char* name)
|
void set_ontimeout(const char* name)
|
||||||
{
|
{
|
||||||
asprintf(&on_timeout, "%s", name);
|
int res = asprintf(&on_timeout, "%s", name);
|
||||||
|
CHECK_RES_DIE(res, "asprintf");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the protocol to connect to in case of timeout;
|
/* Returns the protocol to connect to in case of timeout;
|
||||||
|
@ -79,11 +79,14 @@ static void print_usage(void)
|
|||||||
{
|
{
|
||||||
struct proto *p;
|
struct proto *p;
|
||||||
int i;
|
int i;
|
||||||
|
int res;
|
||||||
char *prots = "";
|
char *prots = "";
|
||||||
|
|
||||||
p = get_builtins();
|
p = get_builtins();
|
||||||
for (i = 0; i < get_num_builtins(); i++)
|
for (i = 0; i < get_num_builtins(); i++) {
|
||||||
asprintf(&prots, "%s\t[--%s <addr>]\n", prots, p[i].description);
|
res = asprintf(&prots, "%s\t[--%s <addr>]\n", prots, p[i].description);
|
||||||
|
CHECK_RES_DIE(res, "asprintf");
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stderr, USAGE_STRING, prots);
|
fprintf(stderr, USAGE_STRING, prots);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user