Fix invalid pointer use in get_my_hostname().
clang-3.7 warnings surfaced an actual bug:
invitation.c:185:5: error: address of array 'filename' will always evaluate to 'true'
[-Werror,-Wpointer-bool-conversion]
if(filename) {
~~ ^~~~~~~~
The regression was introduced in 3ccdf50beb
.
This commit is contained in:
parent
7fcfbe2bd2
commit
9e3adef5cb
1 changed files with 2 additions and 2 deletions
|
@ -84,7 +84,7 @@ char *get_my_hostname() {
|
||||||
char *port = NULL;
|
char *port = NULL;
|
||||||
char *hostport = NULL;
|
char *hostport = NULL;
|
||||||
char *name = get_my_name(false);
|
char *name = get_my_name(false);
|
||||||
char filename[PATH_MAX];
|
char filename[PATH_MAX] = {0};
|
||||||
|
|
||||||
// Use first Address statement in own host config file
|
// Use first Address statement in own host config file
|
||||||
if(check_id(name)) {
|
if(check_id(name)) {
|
||||||
|
@ -182,7 +182,7 @@ again:
|
||||||
hostname = xstrdup(line);
|
hostname = xstrdup(line);
|
||||||
|
|
||||||
save:
|
save:
|
||||||
if(filename) {
|
if(*filename) {
|
||||||
FILE *f = fopen(filename, "a");
|
FILE *f = fopen(filename, "a");
|
||||||
if(f) {
|
if(f) {
|
||||||
fprintf(f, "\nAddress = %s\n", hostname);
|
fprintf(f, "\nAddress = %s\n", hostname);
|
||||||
|
|
Loading…
Reference in a new issue