From 7e7bb8278e154e417c62c0fcfff4c152e8015edb Mon Sep 17 00:00:00 2001 From: Marc Fiuczynski Date: Thu, 30 Oct 2008 06:13:37 +0000 Subject: [PATCH] support reading of negative numbers for rlimit values --- src/planetlab.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/planetlab.c b/src/planetlab.c index 90ba4dd..db9c430 100644 --- a/src/planetlab.c +++ b/src/planetlab.c @@ -356,8 +356,13 @@ pl_get_limits(const char *context, struct sliver_resources *slr) buf[len-1]='\0'; len --; } - if ( (r->type == TYPE_LONG) && isdigit(*buf)) { - *r->limit = atoi(buf); + if (r->type == TYPE_LONG) { + int val; + char *res=0; + errno=0; + val = strtol(buf,&res,0); + if ( !( (val==0 && res) || (errno!=0) ) ) + *r->limit = val; } else if ( (r->type == TYPE_PERS) && isalpha(*buf)) { unsigned long int res; res = vc_str2personalitytype(buf,len); -- 2.43.0