summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-08-11 19:24:27 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-08-11 19:24:27 (GMT)
commit9ecbc07256d273ffb1a712594e06c75159888ac4 (patch)
treef10fac1043c7ee53efc455d1c82df9701cd37d73 /Modules/posixmodule.c
parent00091cada63a756937a39d5e6967666301154b57 (diff)
downloadcpython-9ecbc07256d273ffb1a712594e06c75159888ac4.zip
cpython-9ecbc07256d273ffb1a712594e06c75159888ac4.tar.gz
cpython-9ecbc07256d273ffb1a712594e06c75159888ac4.tar.bz2
Merged revisions 83951 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83951 | benjamin.peterson | 2010-08-11 14:20:42 -0500 (Wed, 11 Aug 2010) | 4 lines use pep 383 decoding for mknod and mkfifo #9570 Patch by David Watson. ........
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index d6e491c..951323b 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -5272,14 +5272,18 @@ Create a FIFO (a POSIX named pipe).");
static PyObject *
posix_mkfifo(PyObject *self, PyObject *args)
{
+ PyObject *opath;
char *filename;
int mode = 0666;
int res;
- if (!PyArg_ParseTuple(args, "s|i:mkfifo", &filename, &mode))
+ if (!PyArg_ParseTuple(args, "O&|i:mkfifo", PyUnicode_FSConverter, &opath,
+ &mode))
return NULL;
+ filename = PyBytes_AS_STRING(opath);
Py_BEGIN_ALLOW_THREADS
res = mkfifo(filename, mode);
Py_END_ALLOW_THREADS
+ Py_DECREF(opath);
if (res < 0)
return posix_error();
Py_INCREF(Py_None);
@@ -5302,15 +5306,19 @@ os.makedev()), otherwise it is ignored.");
static PyObject *
posix_mknod(PyObject *self, PyObject *args)
{
+ PyObject *opath;
char *filename;
int mode = 0600;
int device = 0;
int res;
- if (!PyArg_ParseTuple(args, "s|ii:mknod", &filename, &mode, &device))
+ if (!PyArg_ParseTuple(args, "O&|ii:mknod", PyUnicode_FSConverter, &opath,
+ &mode, &device))
return NULL;
+ filename = PyBytes_AS_STRING(opath);
Py_BEGIN_ALLOW_THREADS
res = mknod(filename, mode, device);
Py_END_ALLOW_THREADS
+ Py_DECREF(opath);
if (res < 0)
return posix_error();
Py_INCREF(Py_None);