projects
/
util-vserver.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
be766a3
)
Leave off trailing \0s
author
Daniel Hokka Zakrisson
<daniel@hozac.com>
Thu, 19 May 2011 10:38:31 +0000 (12:38 +0200)
committer
Daniel Hokka Zakrisson
<daniel@hozac.com>
Thu, 19 May 2011 10:38:31 +0000 (12:38 +0200)
python/_libvserver.c
patch
|
blob
|
history
diff --git
a/python/_libvserver.c
b/python/_libvserver.c
index
d433d4b
..
f675971
100644
(file)
--- a/
python/_libvserver.c
+++ b/
python/_libvserver.c
@@
-591,6
+591,7
@@
pyvserver_get_vhi_name(PyObject UNUSED *self, PyObject *args)
xid_t xid;
vc_uts_type type;
char val[65];
+ int i;
if (!PyArg_ParseTuple(args, "Ii", &xid, &type))
return NULL;
@@
-598,7
+599,10
@@
pyvserver_get_vhi_name(PyObject UNUSED *self, PyObject *args)
if (vc_get_vhi_name(xid, type, val, sizeof(val)) == -1)
return PyErr_SetFromErrno(PyExc_OSError);
- return Py_BuildValue("s#", val, sizeof(val));
+ for (i = sizeof(val); i > 0 && val[i - 1] == '\0'; i--)
+ ;
+
+ return Py_BuildValue("s#", val, i);
}
static PyObject *