summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Sitbon <nsitbon@denyall.com>2011-03-25 15:07:23 +0100
committerThomas Graf <tgraf@suug.ch>2011-03-25 16:51:31 +0100
commit7e9d5f69e54d209955f3a0154751e1a526a69c9f (patch)
tree84ff9ce55790b8ac169187e5f36a90f5041c420f
parente4b507e290475b59b08a022b1805f693d7867355 (diff)
downloadlibnl-7e9d5f69e54d209955f3a0154751e1a526a69c9f.tar.gz
correctly handle the object not found case
Removing non existent route (both ipv4 and ipv6) using rtnl_route_delete return NLE_FAILURE generic error code. After investigation, it seems the linux kernel return -ESRCH in that case (see http://lxr.linux.no/linux+v2.6.38/net/ipv6/route.c#L1367). Same behaviour apply for removing non existent address. The function nl_syserr2nlerr (lib/error.c) which is responsible for translating from kernel error to libnl error doesn't handle ESRCH.
-rw-r--r--lib/error.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/error.c b/lib/error.c
index a31461e..b973cdd 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -88,6 +88,7 @@ int nl_syserr2nlerr(int error)
case EADDRINUSE: return NLE_EXIST;
case EEXIST: return NLE_EXIST;
case EADDRNOTAVAIL: return NLE_NOADDR;
+ case ESRCH: /* fall through */
case ENOENT: return NLE_OBJ_NOTFOUND;
case EINTR: return NLE_INTR;
case EAGAIN: return NLE_AGAIN;