diff --git a/kitty/data-types.c b/kitty/data-types.c index 285abba50..9172f319d 100644 --- a/kitty/data-types.c +++ b/kitty/data-types.c @@ -654,10 +654,9 @@ abspath(PyObject *self UNUSED, PyObject *path) { static PyObject* py_makedirs(PyObject *self UNUSED, PyObject *args) { - int mode = 0755; const char *p; Py_ssize_t sz; - if (!PyArg_ParseTuple(args, "s#|i", &p, &sz, &mode)) return NULL; - RAII_PyObject(b, PyBytes_FromStringAndSize(p, sz)); - if (!makedirs(PyBytes_AS_STRING(b), mode)) { PyErr_SetFromErrno(PyExc_OSError); return NULL; } + int mode = 0755; const char *p; + if (!PyArg_ParseTuple(args, "s|i", &p, &mode)) return NULL; + if (!makedirs(p, mode)) { PyErr_SetFromErrno(PyExc_OSError); return NULL; } Py_RETURN_NONE; } diff --git a/kitty/launcher/utils.h b/kitty/launcher/utils.h index 6c1ebe57c..ae07c2323 100644 --- a/kitty/launcher/utils.h +++ b/kitty/launcher/utils.h @@ -145,10 +145,11 @@ makedirs_cleaned(char *path, int mode, struct stat *buffer) { } static bool -makedirs(char *path /* path is modified by this function */, int mode) { +makedirs(const char *path, int mode) { struct stat buffer; - clean_path(path); - return makedirs_cleaned(path, mode, &buffer); + char pbuf[PATH_MAX]; + lexical_absolute_path(path, pbuf, sizeof(pbuf)); + return makedirs_cleaned(pbuf, mode, &buffer); } static bool