X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fplanetlab.c;h=d3669e38ecab6e404976a70b8175f4292f4e1bc1;hb=f925934b595e983e5f0d980402b72bac7dd8e927;hp=90ba4dd278cd912463cce36e7b18837fbd2b61e9;hpb=a4750b971298b0b51f8db259b7f8f5976ee461d5;p=util-vserver-pl.git diff --git a/src/planetlab.c b/src/planetlab.c index 90ba4dd..d3669e3 100644 --- a/src/planetlab.c +++ b/src/planetlab.c @@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include #define _GNU_SOURCE #include @@ -50,6 +51,9 @@ POSSIBILITY OF SUCH DAMAGE. #include "vserver.h" #include "planetlab.h" +/* defined in netns.c */ +extern uint32_t get_space_flag(xid_t); + #ifndef VC_NXC_RAW_SOCKET # define VC_NXC_RAW_SOCKET 0x00000200ull #endif @@ -89,8 +93,6 @@ tag: if (vc_tag_create(ctx) == VC_NOCTX) return -1; -process: - /* * Create context info - this sets the STATE_SETUP and STATE_INIT flags. */ @@ -356,8 +358,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); @@ -370,7 +377,7 @@ pl_get_limits(const char *context, struct sliver_resources *slr) fclose(fb); } - fchdir(cwd); + (void)fchdir(cwd); out_fd: close(cwd); out: