mirror of
https://github.com/systemd/systemd.git
synced 2024-12-04 15:53:41 +08:00
util: introduce mkdir_p()
This commit is contained in:
parent
e05797fba2
commit
bbd6713566
14
util.c
14
util.c
@ -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";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user