coverity: #1425888

check return value of getifaddrs() Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 7641e5d7
......@@ -1915,6 +1915,7 @@ static const char padchar[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char *lxc_mkifname(char *template)
{
int ret;
unsigned int seed;
FILE *urandom;
struct ifaddrs *ifa, *ifaddr;
......@@ -1926,7 +1927,11 @@ char *lxc_mkifname(char *template)
return NULL;
/* Get all the network interfaces. */
getifaddrs(&ifaddr);
ret = getifaddrs(&ifaddr);
if (ret < 0) {
ERROR("%s - Failed to get network interfaces", strerror(errno));
return NULL;
}
/* Initialize the random number generator. */
urandom = fopen("/dev/urandom", "r");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment