Log unexpected arguments.
(cherry picked from commit 3e7b1d8f783320d38382089a3c9a790ba13772dc)
Bug: 15340961
Change-Id: Iff172b066aa468f9ee36aab661a8b51cb03db95b
diff --git a/clatd.c b/clatd.c
index 0ee3831..6871129 100644
--- a/clatd.c
+++ b/clatd.c
@@ -458,10 +458,11 @@
mark_str = optarg;
break;
case 'h':
- default:
print_help();
+ exit(0);
+ default:
+ logmsg(ANDROID_LOG_FATAL, "Unknown option -%c. Exiting.", (char) optopt);
exit(1);
- break;
}
}
@@ -480,8 +481,10 @@
exit(1);
}
- logmsg(ANDROID_LOG_INFO, "Starting clat version %s on %s netid=%s mark=%s", CLATD_VERSION,
- uplink_interface, net_id_str, mark_str);
+ logmsg(ANDROID_LOG_INFO, "Starting clat version %s on %s netid=%s mark=%s",
+ CLATD_VERSION, uplink_interface,
+ net_id_str ? net_id_str : "(none)",
+ mark_str ? mark_str : "(none)");
// open the tunnel device and our raw sockets before dropping privs
tunnel.fd4 = tun_open();