pppoe-discovery: use correct exit code depending on PADO replies.
authorMartin Schiller <ms@dev.tdt.de>
Thu, 7 Dec 2017 07:55:53 +0000 (08:55 +0100)
committerMartin Schiller <ms@dev.tdt.de>
Mon, 11 Dec 2017 12:51:30 +0000 (13:51 +0100)
This makes it possible to evaluate the exit code of the tool,
e.g. if you just want to know if there is an access concentrator
or not.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
pppd/plugins/rp-pppoe/pppoe-discovery.c

index 3c19dfa0031c105e0416d58ee489a34edd6445a0..784bd718b6dbfc1445fd50d064a14af2c2083ce8 100644 (file)
@@ -698,7 +698,11 @@ int main(int argc, char *argv[])
     conn->printACNames = 1;
 
     discovery(conn);
-    exit(0);
+
+    if (!conn->numPADOs)
+       exit(1);
+    else
+       exit(0);
 }
 
 void rp_fatal(char const *str)