build: fix compile warnings in DNS manager

Fixes the following warnings in nm-dns-manager.c with NETCONFIG_PATH set:

  dns-manager/nm-dns-manager.c: In function 'dispatch_netconfig':
  dns-manager/nm-dns-manager.c:313:2: warning: implicit declaration of function 'waitpid' [-Wimplicit-function-declaration]
    ret = waitpid (pid, NULL, 0);
    ^
  dns-manager/nm-dns-manager.c:271:14: warning: unused variable 'tmp' [-Wunused-variable]
    char *str, *tmp;
                ^
  dns-manager/nm-dns-manager.c:329:13: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
    return ret > 0;
               ^
This commit is contained in:
Beniamino Galvani 2015-03-26 18:12:17 +01:00
parent 3db2e9d013
commit fa19fc0a7a

View file

@ -29,6 +29,8 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <linux/fs.h>
@ -268,10 +270,10 @@ dispatch_netconfig (char **searches,
char **nis_servers,
GError **error)
{
char *str, *tmp;
char *str;
GPid pid;
gint fd;
int ret;
int ret = 1;
pid = run_netconfig (error, &fd);
if (pid < 0)
@ -320,6 +322,7 @@ dispatch_netconfig (char **searches,
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED,
"Error waiting for netconfig to exit: %s",
strerror (errno));
ret = 0;
}
}