[New-bugs-announce] [issue23098] mknod devices can be >32 bits
Jesús Cea Avión
report at bugs.python.org
Sun Dec 21 23:36:24 CET 2014
New submission from Jesús Cea Avión:
Dan MacDonald told me that "os.mknod()" should accept devices >32 bits.
I wrote this code in linux 64 bits:
"""
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main(void) {
printf("%d", sizeof(dev_t));
return 0;
}
"""
The result of running this is "8". We need a long long.
I did this change in Python 2.7 branch:
"""
diff -r f00412d32b41 Modules/posixmodule.c
--- a/Modules/posixmodule.c Sat Dec 20 13:41:14 2014 -0600
+++ b/Modules/posixmodule.c Sun Dec 21 23:30:00 2014 +0100
@@ -7009,9 +7009,9 @@
{
char *filename;
int mode = 0600;
- int device = 0;
+ long long device = 0;
int res;
- if (!PyArg_ParseTuple(args, "s|ii:mknod", &filename, &mode, &device))
+ if (!PyArg_ParseTuple(args, "s|iL:mknod", &filename, &mode, &device))
return NULL;
Py_BEGIN_ALLOW_THREADS
res = mknod(filename, mode, device);
"""
Looks like this patch is trivial. Please, comment.
----------
assignee: jcea
keywords: easy
messages: 233004
nosy: jcea
priority: normal
severity: normal
stage: patch review
status: open
title: mknod devices can be >32 bits
versions: Python 2.7, Python 3.4, Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23098>
_______________________________________
More information about the New-bugs-announce
mailing list