]> git.ipfire.org Git - people/ms/libloc.git/blobdiff - src/python/writer.c
Replace strerror(errno) with %m in format string throughout
[people/ms/libloc.git] / src / python / writer.c
index c54596a1aba6af6a83e84a322d6c088705baae54..5d8027c88c57fde19e7af9610df7a5b83dfb1c60 100644 (file)
@@ -227,7 +227,7 @@ static PyObject* Writer_write(WriterObject* self, PyObject* args) {
 
        FILE* f = fopen(path, "w+");
        if (!f) {
-               PyErr_Format(PyExc_IOError, strerror(errno));
+               PyErr_SetFromErrno(PyExc_OSError);
                return NULL;
        }
 
@@ -236,7 +236,7 @@ static PyObject* Writer_write(WriterObject* self, PyObject* args) {
 
        // Raise any errors
        if (r) {
-               PyErr_Format(PyExc_IOError, strerror(errno));
+               PyErr_SetFromErrno(PyExc_OSError);
                return NULL;
        }