From 4665e4fdca863b8346ed2cc39304f2c763e183a9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 23 Feb 2010 15:44:08 -0500 Subject: [PATCH] parallel: Allow a decimal load value to be specified with -l --- debian/changelog | 1 + parallel.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index b0ac071..599ad9d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ moreutils (0.39) UNRELEASED; urgency=low * parallel: Fix to really avoid running new jobs when load is too high. * parallel: Fix logic error in code handling -l that could make parallel return a bogus 255 exit code when all jobs succeeded. Closes: #569617 + * parallel: Allow a decimal load value to be specified with -l -- Joey Hess Sun, 21 Feb 2010 13:16:10 -0500 diff --git a/parallel.c b/parallel.c index 6bd4665..c3b9d67 100644 --- a/parallel.c +++ b/parallel.c @@ -100,7 +100,7 @@ int wait_for_child(int options) { int main(int argc, char **argv) { int maxjobs = -1; int curjobs = 0; - int maxload = -1; + double maxload = -1; int argsatonce = 1; int opt; char **command = calloc(sizeof(char*), argc); @@ -132,7 +132,7 @@ int main(int argc, char **argv) { break; case 'l': errno = 0; - maxload = strtoul(optarg, &t, 0); + maxload = strtod(optarg, &t); if (errno != 0 || (t-optarg) != strlen(optarg)) { fprintf(stderr, "option '%s' is not a number\n", optarg); -- 2.39.5