Displaying 1 result from an estimated 1 matches for "check_for_dev".
Did you mean:
  check_for_devs
  
2003 Apr 29
0
[PATCH] ipconfig: fix memory leak, and exit if no interfaces to configure
...init_if(dev) == -1)
-		return;
+		goto bail;
 
 	printf("IP-Config: %s hardware address", dev->name);
 	for (i = 0; i < dev->hwlen; i++)
@@ -406,6 +406,22 @@
 
 	if (dev->caps && netdev_up(dev) == 0)
 		add_one_dev(dev);
+	return;
+ bail:
+	free(dev);
+}
+
+static void check_for_devs(void)
+{
+	struct state *s;
+	
+	for (s = slist; s; s = s->next) {
+		if (s->dev->caps)
+			return;
+	}
+
+	fprintf(stderr, "%s: no devices to configure\n", progname);
+	exit(1);
 }
 
 int main(int argc, char *argv[])
@@ -430,8 +446,6 @@
 			}
 			local_port = port;
 			remote_p...