From 011ef60c4b12e4d9f63e85f1a71543c09b30678d Mon Sep 17 00:00:00 2001 From: NAKAMURA Gou Date: Wed, 30 Oct 2013 12:02:29 +0900 Subject: [PATCH] support decimal numbers at MCKERNEL_RLIMIT_STACK --- executer/user/mcexec.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/executer/user/mcexec.c b/executer/user/mcexec.c index 48535136..45ea5a83 100644 --- a/executer/user/mcexec.c +++ b/executer/user/mcexec.c @@ -537,7 +537,6 @@ int main(int argc, char **argv) char *path; int error; struct rlimit rlim_stack; - int n; unsigned long lcur; unsigned long lmax; @@ -626,8 +625,16 @@ int main(int argc, char **argv) p = getenv(rlimit_stack_envname); if (p) { - n = sscanf(p, "%lx,%lx", &lcur, &lmax); - if (n != 2) { + errno = 0; + lcur = strtoul(p, &p, 0); + if (errno || (*p != ',')) { + fprintf(stderr, "Error: Failed to parse %s\n", + rlimit_stack_envname); + return 1; + } + errno = 0; + lmax = strtoul(p+1, &p, 0); + if (errno || (*p != '\0')) { fprintf(stderr, "Error: Failed to parse %s\n", rlimit_stack_envname); return 1;