diff options
Diffstat (limited to 'lib/mkdir.c')
-rw-r--r-- | lib/mkdir.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/mkdir.c b/lib/mkdir.c index 3d9f043802..e6dbc78e09 100644 --- a/lib/mkdir.c +++ b/lib/mkdir.c @@ -56,7 +56,13 @@ rpl_mkdir (char const *dir, mode_t mode maybe_unused) if (len && dir[len - 1] == '/') { - tmp_dir = xstrdup (dir); + tmp_dir = strdup (dir); + if (!tmp_dir) + { + /* Rather than rely on strdup-posix, we set errno ourselves. */ + errno = ENOMEM; + return -1; + } strip_trailing_slashes (tmp_dir); } else |