From a7d9f3135d88497bc215e9e733e58c65c1c5e2b8 Mon Sep 17 00:00:00 2001 From: mpi Date: Wed, 21 Oct 2015 08:47:01 +0000 Subject: [PATCH] Return the correct error code when a table already exists. --- sys/net/rtable.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/net/rtable.c b/sys/net/rtable.c index 90a8cc10db7..ae13f2ff0a5 100644 --- a/sys/net/rtable.c +++ b/sys/net/rtable.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtable.c,v 1.12 2015/10/14 10:09:30 mpi Exp $ */ +/* $OpenBSD: rtable.c,v 1.13 2015/10/21 08:47:01 mpi Exp $ */ /* * Copyright (c) 2014-2015 Martin Pieuchot @@ -113,9 +113,12 @@ rtable_add(unsigned int id) unsigned int off; int i; - if (id > RT_TABLEID_MAX || rtable_exists(id)) + if (id > RT_TABLEID_MAX) return (EINVAL); + if (rtable_exists(id)) + return (EEXIST); + for (i = 0; (dp = domains[i]) != NULL; i++) { if (dp->dom_rtoffset == 0) continue; -- 2.20.1