git://git.onelab.eu
/
util-vserver.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5ff22ef
)
Fix error handling for get_rspec
author
Steve Muir
<smuir@cs.princeton.edu>
Fri, 2 Dec 2005 19:18:57 +0000
(19:18 +0000)
committer
Steve Muir
<smuir@cs.princeton.edu>
Fri, 2 Dec 2005 19:18:57 +0000
(19:18 +0000)
python/vserverimpl.c
patch
|
blob
|
history
diff --git
a/python/vserverimpl.c
b/python/vserverimpl.c
index
7a90cf0
..
00c8980
100644
(file)
--- a/
python/vserverimpl.c
+++ b/
python/vserverimpl.c
@@
-54,11
+54,17
@@
get_rspec(PyObject *resources, rspec_t *rspec)
PyErr_SetString(PyExc_TypeError, "invalid rspec");
return -1;
}
PyErr_SetString(PyExc_TypeError, "invalid rspec");
return -1;
}
- if ((cpu_share = PyMapping_GetItemString(resources, "nm_cpu_share")) &&
- (cpu_share = PyNumber_Int(cpu_share)))
- rspec->cpu_share = PyInt_AsLong(cpu_share);
+ if ((cpu_share = PyMapping_GetItemString(resources, "nm_cpu_share")))
+ {
+ if (PyInt_Check(cpu_share))
+ {
+ rspec->cpu_share = PyInt_AS_LONG(cpu_share);
+ return 0;
+ }
+ PyErr_SetString(PyExc_TypeError, "nm_cpu_share not an integer");
+ }
- return
0
;
+ return
-1
;
}
/*
}
/*