diff -r 8cbc438cc298 -r fab0b8a61dcb librazor/root.c --- a/librazor/root.c Thu Feb 16 17:33:47 2012 +0000 +++ b/librazor/root.c Wed Aug 20 18:57:52 2014 +0100 @@ -77,7 +77,7 @@ } RAZOR_EXPORT int -razor_root_create(const char *root) +razor_root_create(const char *root, struct razor_error **error) { int retval; struct stat buf; @@ -92,16 +92,12 @@ /* root is file system root */ } else if (stat(root, &buf) < 0) { if (mkdir(root, 0777) < 0) { - fprintf(stderr, - "could not create install root \"%s\"\n", - root); + razor_set_error(error, root, + "Could not create install root"); return -1; } - fprintf(stderr, "created install root \"%s\"\n", root); } else if (!S_ISDIR(buf.st_mode)) { - fprintf(stderr, - "install root \"%s\" exists, but is not a directory\n", - root); + razor_set_error(error, root, "Not a directory"); return -1; } @@ -109,8 +105,8 @@ path = razor_concat(root, file, NULL); retval = !stat(path, &buf); if (retval) { - fprintf(stderr, - "a razor install root is already initialized\n"); + razor_set_error(error, NULL, + "A razor install root is already initialized"); free(path); free(file); return retval; @@ -124,7 +120,8 @@ free(file); retval = razor_atomic_commit(atomic); if (retval) - fprintf(stderr, "could not write initial package set\n"); + razor_set_error(error, NULL, + "Could not write initial package set"); razor_set_unref(set); razor_atomic_destroy(atomic);