vlan.c: prevent segfault in get_vlan_device_chain() if the base device does not exist
[project/netifd.git] / vlan.c
diff --git a/vlan.c b/vlan.c
index 1e06280..785cc9e 100644 (file)
--- a/vlan.c
+++ b/vlan.c
@@ -1,3 +1,16 @@
+/*
+ * netifd - network interface daemon
+ * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -132,7 +145,7 @@ struct device *get_vlan_device_chain(const char *ifname, bool create)
 
        s = split_vlan(buf);
        dev = device_get(buf, create);
-       if (!dev && !create)
+       if (!dev)
                goto error;
 
        do {