about summary refs log tree commit diff
path: root/src/libmain
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 5affce77ed64..24f6ec4df92b 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -155,10 +155,8 @@ static void initAndRun(int argc, char * * argv)
         else if (arg == "--max-jobs" || arg == "-j") {
             ++i;
             if (i == args.end()) throw UsageError("`--max-jobs' requires an argument");
-            istringstream str(*i);
             int n;
-            str >> n;
-            if (!str || !str.eof() || n < 0)
+            if (!string2Int(*i, n) || n < 0)
                 throw UsageError(format("`--max-jobs' requires a non-negative integer"));
             maxBuildJobs = n;
         }