update_engine: Improve update_engine_client flag checking.

BUG=None
TEST=`update_engine_client --channel canary-channel` fails.

Change-Id: Ib454781a1ba4928ef03b643d4ed18280f1b0e603
Reviewed-on: https://chromium-review.googlesource.com/243699
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Stephen Fung <stevefung@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
diff --git a/update_engine_client.cc b/update_engine_client.cc
index 70bafb4..75da89f 100644
--- a/update_engine_client.cc
+++ b/update_engine_client.cc
@@ -4,6 +4,7 @@
 
 #include <string>
 
+#include <base/command_line.h>
 #include <base/logging.h>
 #include <chromeos/dbus/service_constants.h>
 #include <chromeos/flag_helper.h>
@@ -542,6 +543,16 @@
   dbus_threads_init_default();
   chromeos::FlagHelper::Init(argc, argv, "Chromium OS Update Engine Client");
 
+  // Ensure there are no positional arguments.
+  const std::vector<string> positional_args =
+      base::CommandLine::ForCurrentProcess()->GetArgs();
+  if (!positional_args.empty()) {
+    LOG(ERROR) << "Found a positional argument '" << positional_args.front()
+               << "'. If you want to pass a value to a flag, pass it as "
+                  "--flag=value.";
+    return 1;
+  }
+
   // Update the status if requested.
   if (FLAGS_reset_status) {
     LOG(INFO) << "Setting Update Engine status to idle ...";