1.1 --- a/librazor/root.c Wed Aug 20 18:57:59 2014 +0100
1.2 +++ b/librazor/root.c Sat Aug 23 16:07:09 2014 +0100
1.3 @@ -102,7 +102,7 @@
1.4 }
1.5
1.6 file = razor_concat(razor_root_path, "/", system_repo_filename, NULL);
1.7 - path = razor_concat(root, file, NULL);
1.8 + path = razor_path_add_root(file, root);
1.9 retval = !stat(path, &buf);
1.10 if (retval) {
1.11 razor_set_error(error, NULL,
1.12 @@ -133,7 +133,7 @@
1.13 razor_root_open(const char *root, struct razor_error **error)
1.14 {
1.15 struct razor_root *image;
1.16 - char *lock_path;
1.17 + char *s, *lock_path;
1.18 int r;
1.19
1.20 assert (root != NULL);
1.21 @@ -152,8 +152,9 @@
1.22 return NULL;
1.23 }
1.24
1.25 - lock_path = razor_concat(root, razor_root_path, "/",
1.26 - system_lock_filename, NULL);
1.27 + s = razor_concat(razor_root_path, "/", system_lock_filename, NULL);
1.28 + lock_path = razor_path_add_root(s, root);
1.29 + free(s);
1.30
1.31 r = razor_set_aquire_lock(image->system, lock_path, 1);
1.32
1.33 @@ -167,8 +168,9 @@
1.34 return NULL;
1.35 }
1.36
1.37 - image->path = razor_concat(root, razor_root_path, "/",
1.38 - system_repo_filename, NULL);
1.39 + s = razor_concat(razor_root_path, "/", system_repo_filename, NULL);
1.40 + image->path = razor_path_add_root(s, root);
1.41 + free(s);
1.42
1.43 if (razor_set_bind_sections(image->system, image->path,
1.44 RAZOR_SET_PRIVATE, error)) {
1.45 @@ -184,7 +186,7 @@
1.46 RAZOR_EXPORT struct razor_set *
1.47 razor_root_open_read_only(const char *root, struct razor_error **error)
1.48 {
1.49 - char *path;
1.50 + char *s, *path;
1.51 struct razor_set *set;
1.52
1.53 assert (root != NULL);
1.54 @@ -196,8 +198,10 @@
1.55 return NULL;
1.56 }
1.57
1.58 - path = razor_concat(root, razor_root_path, "/", system_lock_filename,
1.59 - NULL);
1.60 + s = razor_concat(razor_root_path, "/", system_lock_filename, NULL);
1.61 + path = razor_path_add_root(s, root);
1.62 + free(s);
1.63 +
1.64 if (razor_set_aquire_lock(set, path, 0) < 0) {
1.65 razor_set_error(error, NULL,
1.66 "Failed to aquire non-exclusive system lock");
1.67 @@ -207,8 +211,10 @@
1.68 }
1.69
1.70 free(path);
1.71 - path = razor_concat(root, razor_root_path, "/", system_repo_filename,
1.72 - NULL);
1.73 +
1.74 + s = razor_concat(razor_root_path, "/", system_repo_filename, NULL);
1.75 + path = razor_path_add_root(s, root);
1.76 + free(s);
1.77
1.78 if (razor_set_bind_sections(set, path, 0, error)) {
1.79 razor_set_unref(set);