X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=src%2FW1Util.cc;h=452d7290758e7b1eee203e5d27e39c9a03a548a0;hb=8c97cbb9b5f8997fe9ab3917fcbea66d74b45837;hp=08dc7e0e90419341c1202cccd245bf556b3f6173;hpb=6c332c9dfe49d7fe08478946decce32a8f577ef4;p=lib1wire.git diff --git a/src/W1Util.cc b/src/W1Util.cc index 08dc7e0..452d729 100644 --- a/src/W1Util.cc +++ b/src/W1Util.cc @@ -63,7 +63,7 @@ char *W1Util::parse_directory_path(const char *file_path) { return ret_val; } -bool W1Util::mkdirs(char *path) { +bool W1Util::mkdirs(const char *path) { bool ret_val; char *p; int err_flg; @@ -71,13 +71,13 @@ bool W1Util::mkdirs(char *path) { ret_val = true; if (path != NULL) { // go through each directory one by and and create if not exist - for (p = path; *p; p++) { + for (p = (char *)path; *p; p++) { if ((p != path) && ((*p == '/') || (*p == '\\'))) { *p = '\0'; - // test whether directory exist and is writable - if (access(path, F_OK)) { + // if dir does not exist, create it + if (access(path, F_OK) != 0) { log_debug("trying to create directory: %s\n", path); err_flg = mkdir(path, S_IRWXU); if (err_flg != 0) { @@ -89,8 +89,8 @@ bool W1Util::mkdirs(char *path) { } } if (ret_val == true) { - // test also the existense of whole directory - if (access(path, F_OK)) { + // if dir does not exist, create it + if (access(path, F_OK) != 0) { log_debug("trying to create directory: %s\n", path); err_flg = mkdir(path, S_IRWXU); if (err_flg != 0) {