Blob Blame History Raw
From 0abd4986f9d0b41cea18453e60fe2947e6eae047 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Wed, 9 Dec 2009 08:54:41 +0100
Subject: [PATCH] Gracefuly exit upon pcap_findalldevs() error

---
 bandwidthd.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/bandwidthd.c b/bandwidthd.c
index a0d18d0..d69737f 100644
--- a/bandwidthd.c
+++ b/bandwidthd.c
@@ -320,6 +320,11 @@ int main(int argc, char **argv)
 
 #ifdef HAVE_PCAP_FINDALLDEVS
 	pcap_findalldevs(&Devices, Error);
+	if (Devices == NULL)
+		{
+		printf("Can't find network devices: %s", Error);
+		exit(1);
+		}
 	if (config.dev == NULL && Devices->name)
 		config.dev = strdup(Devices->name);
 	if (ListDevices)
-- 
1.6.5.3