39#include "xbps_api_impl.h"
49 if ((ppath = strdup(path)) == NULL)
60 mode = (S_IRWXU | S_IRWXG | S_IRWXO) & ~umask(0);
62 dir_mode = mode | S_IRUSR | S_IXUSR | S_IROTH | S_IXOTH;
65 slash += strspn(slash,
"/");
66 slash += strcspn(slash,
"/");
68 done = (*slash ==
'\0');
71 if (mkdir(ppath, done ? mode : dir_mode) == -1) {
79 if (stat(ppath, &sb) < 0) {
85 if (!S_ISDIR(sb.st_mode)) {
int xbps_mkpath(const char *path, mode_t mode)