[minijail] Update to new libchrome API
CommandLine::GetLooseValues() is deprecated, in favor of
CommandLine::args(), which returns a vector of strings.
BUG=None
TEST=Compile
Change-Id: Ia34ba23f275065b3ff267e89ff5a70cfdf6bef84
Review URL: http://codereview.chromium.org/3173010
diff --git a/SConstruct b/SConstruct
index dc32ec3..d0f2d6d 100644
--- a/SConstruct
+++ b/SConstruct
@@ -23,8 +23,10 @@
CPPPATH=['..', '../../third_party/chrome/files', '../../common'],
CCFLAGS=['-g'],
LIBPATH=['../../third_party/chrome'],
- LIBS=['cap', 'base', 'pthread', 'rt'],
+ LIBS=['cap', 'glib-2.0', 'base', 'pthread', 'rt'],
)
+# glib-2.0 is only required by libbase
+
for key in Split('CC CXX AR RANLIB LD NM CFLAGS CCFLAGS'):
value = os.environ.get(key)
if value != None:
@@ -32,10 +34,12 @@
env['CCFLAGS'] += ['-fno-exceptions', '-Wall', '-Werror']
# Fix issue with scons not passing some vars through the environment.
-for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH SYSROOT'):
+for key in Split('PKG_CONFIG SYSROOT'):
if os.environ.has_key(key):
env['ENV'][key] = os.environ[key]
+env.ParseConfig('%s --cflags --libs glib-2.0' % env['ENV']['PKG_CONFIG'])
+
env_lib = env.Clone()
env_lib.SharedLibrary('minijail', lib_sources)
diff --git a/minijail_main.cc b/minijail_main.cc
index 01dd582..a40397c 100644
--- a/minijail_main.cc
+++ b/minijail_main.cc
@@ -116,16 +116,13 @@
// Grab the loose args to use as the command line.
// We have to wstring->argv[][] manually. Ugh.
- std::vector<std::wstring> loose_wide_args = cl->GetLooseValues();
- std::vector<std::string> loose_args(loose_wide_args.size());
- char const* *jailed_argv = new char const*[loose_wide_args.size() + 1];
- std::vector<std::wstring>::const_iterator arg_it = loose_wide_args.begin();
+ std::vector<std::string> loose_args = cl->args();
+ char const* *jailed_argv = new char const*[loose_args.size() + 1];
+ std::vector<std::string>::const_iterator arg_it = loose_args.begin();
char const* *ja = jailed_argv;
- for (; arg_it != loose_wide_args.end(); ++arg_it) {
- std::string arg = WideToASCII(*arg_it);
- loose_args.push_back(arg);
+ for (; arg_it != loose_args.end(); ++arg_it) {
// XXX: clean up this leak even though it doesn't matter.
- *ja++ = strdup(arg.c_str());
+ *ja++ = strdup(arg_it->c_str());
}
*ja = 0;
@@ -155,4 +152,3 @@
bool ok = jail.Jail() && jail.Run();
return !ok;
}
-