Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
c1ee94cf
Commit
c1ee94cf
authored
Nov 28, 2013
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python3: Use FSConverter for all paths
Signed-off-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
Acked-by:
Serge E. Hallyn
<
serge.hallyn@ubuntu.com
>
parent
a15877ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
9 deletions
+60
-9
lxc.c
src/python-lxc/lxc.c
+60
-9
No files found.
src/python-lxc/lxc.c
View file @
c1ee94cf
...
@@ -510,16 +510,33 @@ Container_add_device_node(Container *self, PyObject *args, PyObject *kwds)
...
@@ -510,16 +510,33 @@ Container_add_device_node(Container *self, PyObject *args, PyObject *kwds)
static
char
*
kwlist
[]
=
{
"src_path"
,
"dest_path"
,
NULL
};
static
char
*
kwlist
[]
=
{
"src_path"
,
"dest_path"
,
NULL
};
char
*
src_path
=
NULL
;
char
*
src_path
=
NULL
;
char
*
dst_path
=
NULL
;
char
*
dst_path
=
NULL
;
PyObject
*
py_src_path
=
NULL
;
PyObject
*
py_dst_path
=
NULL
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"s|s"
,
kwlist
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"O&|O&"
,
kwlist
,
&
src_path
,
&
dst_path
))
PyUnicode_FSConverter
,
&
py_src_path
,
PyUnicode_FSConverter
,
&
py_dst_path
))
return
NULL
;
return
NULL
;
if
(
py_src_path
!=
NULL
)
{
src_path
=
PyBytes_AS_STRING
(
py_src_path
);
assert
(
src_path
!=
NULL
);
}
if
(
py_dst_path
!=
NULL
)
{
dst_path
=
PyBytes_AS_STRING
(
py_dst_path
);
assert
(
dst_path
!=
NULL
);
}
if
(
self
->
container
->
add_device_node
(
self
->
container
,
src_path
,
if
(
self
->
container
->
add_device_node
(
self
->
container
,
src_path
,
dst_path
))
{
dst_path
))
{
Py_XDECREF
(
py_src_path
);
Py_XDECREF
(
py_dst_path
);
Py_RETURN_TRUE
;
Py_RETURN_TRUE
;
}
}
Py_XDECREF
(
py_src_path
);
Py_XDECREF
(
py_dst_path
);
Py_RETURN_FALSE
;
Py_RETURN_FALSE
;
}
}
...
@@ -611,14 +628,16 @@ Container_clone(Container *self, PyObject *args, PyObject *kwds)
...
@@ -611,14 +628,16 @@ Container_clone(Container *self, PyObject *args, PyObject *kwds)
char
**
hookargs
=
NULL
;
char
**
hookargs
=
NULL
;
PyObject
*
py_hookargs
=
NULL
;
PyObject
*
py_hookargs
=
NULL
;
PyObject
*
py_config_path
=
NULL
;
struct
lxc_container
*
new_container
=
NULL
;
struct
lxc_container
*
new_container
=
NULL
;
int
i
=
0
;
int
i
=
0
;
static
char
*
kwlist
[]
=
{
"newname"
,
"config_path"
,
"flags"
,
"bdevtype"
,
static
char
*
kwlist
[]
=
{
"newname"
,
"config_path"
,
"flags"
,
"bdevtype"
,
"bdevdata"
,
"newsize"
,
"hookargs"
,
NULL
};
"bdevdata"
,
"newsize"
,
"hookargs"
,
NULL
};
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"s|sisskO"
,
kwlist
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"s|O&isskO"
,
kwlist
,
&
newname
,
&
config_path
,
&
flags
,
&
newname
,
&
bdevtype
,
&
bdevdata
,
&
newsize
,
PyUnicode_FSConverter
,
&
py_config_path
,
&
flags
,
&
bdevtype
,
&
bdevdata
,
&
newsize
,
&
py_hookargs
))
&
py_hookargs
))
return
NULL
;
return
NULL
;
...
@@ -635,10 +654,17 @@ Container_clone(Container *self, PyObject *args, PyObject *kwds)
...
@@ -635,10 +654,17 @@ Container_clone(Container *self, PyObject *args, PyObject *kwds)
}
}
}
}
if
(
py_config_path
!=
NULL
)
{
config_path
=
PyBytes_AS_STRING
(
py_config_path
);
assert
(
config_path
!=
NULL
);
}
new_container
=
self
->
container
->
clone
(
self
->
container
,
newname
,
new_container
=
self
->
container
->
clone
(
self
->
container
,
newname
,
config_path
,
flags
,
bdevtype
,
config_path
,
flags
,
bdevtype
,
bdevdata
,
newsize
,
hookargs
);
bdevdata
,
newsize
,
hookargs
);
Py_XDECREF
(
py_config_path
);
if
(
hookargs
)
{
if
(
hookargs
)
{
for
(
i
=
0
;
i
<
PyTuple_GET_SIZE
(
py_hookargs
);
i
++
)
for
(
i
=
0
;
i
<
PyTuple_GET_SIZE
(
py_hookargs
);
i
++
)
free
(
hookargs
[
i
]);
free
(
hookargs
[
i
]);
...
@@ -1010,16 +1036,33 @@ Container_remove_device_node(Container *self, PyObject *args, PyObject *kwds)
...
@@ -1010,16 +1036,33 @@ Container_remove_device_node(Container *self, PyObject *args, PyObject *kwds)
static
char
*
kwlist
[]
=
{
"src_path"
,
"dest_path"
,
NULL
};
static
char
*
kwlist
[]
=
{
"src_path"
,
"dest_path"
,
NULL
};
char
*
src_path
=
NULL
;
char
*
src_path
=
NULL
;
char
*
dst_path
=
NULL
;
char
*
dst_path
=
NULL
;
PyObject
*
py_src_path
=
NULL
;
PyObject
*
py_dst_path
=
NULL
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"s|s"
,
kwlist
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"O&|O&"
,
kwlist
,
&
src_path
,
&
dst_path
))
PyUnicode_FSConverter
,
&
py_src_path
,
PyUnicode_FSConverter
,
&
py_dst_path
))
return
NULL
;
return
NULL
;
if
(
py_src_path
!=
NULL
)
{
src_path
=
PyBytes_AS_STRING
(
py_src_path
);
assert
(
src_path
!=
NULL
);
}
if
(
py_dst_path
!=
NULL
)
{
dst_path
=
PyBytes_AS_STRING
(
py_dst_path
);
assert
(
dst_path
!=
NULL
);
}
if
(
self
->
container
->
remove_device_node
(
self
->
container
,
src_path
,
if
(
self
->
container
->
remove_device_node
(
self
->
container
,
src_path
,
dst_path
))
{
dst_path
))
{
Py_XDECREF
(
py_src_path
);
Py_XDECREF
(
py_dst_path
);
Py_RETURN_TRUE
;
Py_RETURN_TRUE
;
}
}
Py_XDECREF
(
py_src_path
);
Py_XDECREF
(
py_dst_path
);
Py_RETURN_FALSE
;
Py_RETURN_FALSE
;
}
}
...
@@ -1126,13 +1169,21 @@ Container_snapshot(Container *self, PyObject *args, PyObject *kwds)
...
@@ -1126,13 +1169,21 @@ Container_snapshot(Container *self, PyObject *args, PyObject *kwds)
int
retval
=
0
;
int
retval
=
0
;
int
ret
=
0
;
int
ret
=
0
;
char
newname
[
20
];
char
newname
[
20
];
PyObject
*
py_comment_path
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"|
s
"
,
kwlist
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"|
O&
"
,
kwlist
,
&
comment_path
))
PyUnicode_FSConverter
,
&
py_
comment_path
))
return
NULL
;
return
NULL
;
if
(
py_comment_path
!=
NULL
)
{
comment_path
=
PyBytes_AS_STRING
(
py_comment_path
);
assert
(
comment_path
!=
NULL
);
}
retval
=
self
->
container
->
snapshot
(
self
->
container
,
comment_path
);
retval
=
self
->
container
->
snapshot
(
self
->
container
,
comment_path
);
Py_XDECREF
(
py_comment_path
);
if
(
retval
<
0
)
{
if
(
retval
<
0
)
{
Py_RETURN_FALSE
;
Py_RETURN_FALSE
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment