Blame 0001-Gracefuly-exit-upon-pcap_findalldevs-error.patch

08a6ebd
From 0abd4986f9d0b41cea18453e60fe2947e6eae047 Mon Sep 17 00:00:00 2001
08a6ebd
From: Lubomir Rintel <lkundrak@v3.sk>
08a6ebd
Date: Wed, 9 Dec 2009 08:54:41 +0100
08a6ebd
Subject: [PATCH] Gracefuly exit upon pcap_findalldevs() error
08a6ebd
08a6ebd
---
08a6ebd
 bandwidthd.c |    5 +++++
08a6ebd
 1 files changed, 5 insertions(+), 0 deletions(-)
08a6ebd
08a6ebd
diff --git a/bandwidthd.c b/bandwidthd.c
08a6ebd
index a0d18d0..d69737f 100644
08a6ebd
--- a/bandwidthd.c
08a6ebd
+++ b/bandwidthd.c
08a6ebd
@@ -320,6 +320,11 @@ int main(int argc, char **argv)
08a6ebd
 
08a6ebd
 #ifdef HAVE_PCAP_FINDALLDEVS
08a6ebd
 	pcap_findalldevs(&Devices, Error);
08a6ebd
+	if (Devices == NULL)
08a6ebd
+		{
08a6ebd
+		printf("Can't find network devices: %s", Error);
08a6ebd
+		exit(1);
08a6ebd
+		}
08a6ebd
 	if (config.dev == NULL && Devices->name)
08a6ebd
 		config.dev = strdup(Devices->name);
08a6ebd
 	if (ListDevices)
08a6ebd
-- 
08a6ebd
1.6.5.3
08a6ebd