Skip to content

Commit

Permalink
Tweak return value handling
Browse files Browse the repository at this point in the history
rtrequest1 ensures to return an rtentry on success.
  • Loading branch information
ozaki-r committed Dec 22, 2015
1 parent b0435a0 commit 4d46797
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sys/net/route.c
@@ -1,4 +1,4 @@
/* $NetBSD: route.c,v 1.152 2015/10/07 09:44:26 roy Exp $ */
/* $NetBSD: route.c,v 1.153 2015/12/22 01:59:21 ozaki-r Exp $ */

/*-
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -96,7 +96,7 @@
#endif

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.152 2015/10/07 09:44:26 roy Exp $");
__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.153 2015/12/22 01:59:21 ozaki-r Exp $");

#include <sys/param.h>
#ifdef RTFLUSH_DEBUG
Expand Down Expand Up @@ -1060,9 +1060,10 @@ rtinit(struct ifaddr *ifa, int cmd, int flags)
info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
error = rtrequest1((cmd == RTM_LLINFO_UPD) ? RTM_GET : cmd, &info,
&nrt);
if (error != 0 || (rt = nrt) == NULL)
if (error != 0)
return error;

rt = nrt;
switch (cmd) {
case RTM_DELETE:
rt_newmsg(cmd, rt);
Expand Down

0 comments on commit 4d46797

Please sign in to comment.