mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
- Fix build failure of _cursesmodule.c building with -D_FORTIFY_SOURCE=2.
This commit is contained in:
parent
1ff110d8b3
commit
7e1b8faacc
2 changed files with 10 additions and 1 deletions
|
@ -19,6 +19,8 @@ Core and Builtins
|
||||||
- Issue #4367: Python would segfault during compiling when the unicodedata
|
- Issue #4367: Python would segfault during compiling when the unicodedata
|
||||||
module couldn't be imported and \N escapes were present.
|
module couldn't be imported and \N escapes were present.
|
||||||
|
|
||||||
|
- Fix build failure of _cursesmodule.c building with -D_FORTIFY_SOURCE=2.
|
||||||
|
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -1857,6 +1857,7 @@ PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
|
||||||
int fd;
|
int fd;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
PyObject *data;
|
PyObject *data;
|
||||||
|
size_t datalen;
|
||||||
WINDOW *win;
|
WINDOW *win;
|
||||||
|
|
||||||
PyCursesInitialised
|
PyCursesInitialised
|
||||||
|
@ -1886,7 +1887,13 @@ PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
|
||||||
remove(fn);
|
remove(fn);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
fwrite(PyBytes_AS_STRING(data), 1, PyBytes_GET_SIZE(data), fp);
|
datalen = PyBytes_GET_SIZE(data);
|
||||||
|
if (fwrite(PyBytes_AS_STRING(data), 1, datalen, fp) != datalen) {
|
||||||
|
Py_DECREF(data);
|
||||||
|
fclose(fp);
|
||||||
|
remove(fn);
|
||||||
|
return PyErr_SetFromErrnoWithFilename(PyExc_IOError, fn);
|
||||||
|
}
|
||||||
Py_DECREF(data);
|
Py_DECREF(data);
|
||||||
fseek(fp, 0, 0);
|
fseek(fp, 0, 0);
|
||||||
win = getwin(fp);
|
win = getwin(fp);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue