diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-04-10 04:38:33 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-04-10 04:38:33 +0200 |
commit | bbd671356647d9d2c7d6c2c0401e907e169c7576 (patch) | |
tree | 34bd9909db3e2bc667490ff4c9a7f8d5decdea46 /util.c | |
parent | e05797fba258d7a58987cc8870fae6e34b94fe46 (diff) |
util: introduce mkdir_p()
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -728,6 +728,20 @@ int mkdir_parents(const char *path, mode_t mode) { } } +int mkdir_p(const char *path, mode_t mode) { + int r; + + /* Like mkdir -p */ + + if ((r = mkdir_parents(path, mode)) < 0) + return r; + + if (mkdir(path, mode) < 0) + return -errno; + + return 0; +} + char hexchar(int x) { static const char table[16] = "0123456789abcdef"; |