Initialize get_resolvconf_addr variable rv to NULL

Getting warning compiling for Android:

./util.c:35:6: warning: variable 'rv' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        if (sscanf(buf, "%15s", addr) == 1)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./util.c:79:9: note: uninitialized use occurs here
        return rv;
               ^~
This commit is contained in:
Erik Ekman 2021-08-16 15:05:03 +02:00
parent cfd0b07e1f
commit f5a82afe29

View file

@ -22,7 +22,7 @@
char *get_resolvconf_addr(void) char *get_resolvconf_addr(void)
{ {
static char addr[16]; static char addr[16];
char *rv; char *rv = NULL;
#ifndef WINDOWS32 #ifndef WINDOWS32
char buf[80]; char buf[80];
FILE *fp; FILE *fp;