netlink: make sure to clear return value when trying again
Otherwise this runs in an infinite loop if at some point a dump was interrupted. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
		
							parent
							
								
									95c30bc034
								
							
						
					
					
						commit
						64576f9a06
					
				@ -881,11 +881,12 @@ static void coalesce_peers(struct wgdevice *device)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static int kernel_get_device(struct wgdevice **device, const char *iface)
 | 
					static int kernel_get_device(struct wgdevice **device, const char *iface)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int ret = 0;
 | 
						int ret;
 | 
				
			||||||
	struct nlmsghdr *nlh;
 | 
						struct nlmsghdr *nlh;
 | 
				
			||||||
	struct mnlg_socket *nlg;
 | 
						struct mnlg_socket *nlg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
try_again:
 | 
					try_again:
 | 
				
			||||||
 | 
						ret = 0;
 | 
				
			||||||
	*device = calloc(1, sizeof(**device));
 | 
						*device = calloc(1, sizeof(**device));
 | 
				
			||||||
	if (!*device)
 | 
						if (!*device)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user