librazor/root.c
changeset 410 6c691def7607
parent 403 e63951c1d0f8
child 424 8cbc438cc298
     1.1 --- a/librazor/root.c	Thu Nov 10 10:35:21 2011 +0000
     1.2 +++ b/librazor/root.c	Wed Feb 01 12:46:39 2012 +0000
     1.3 @@ -87,7 +87,7 @@
     1.4  	struct stat buf;
     1.5  	struct razor_set *set;
     1.6  	struct razor_atomic *atomic;
     1.7 -	char *path;
     1.8 +	char *file, *path;
     1.9  
    1.10  	assert (root != NULL);
    1.11  
    1.12 @@ -109,22 +109,23 @@
    1.13  		return -1;
    1.14  	}
    1.15  
    1.16 -	path = razor_concat(root, razor_root_path, "/", system_repo_filename,
    1.17 -			    NULL);
    1.18 +	file = razor_concat(razor_root_path, "/", system_repo_filename, NULL);
    1.19 +	path = razor_concat(root, file, NULL);
    1.20  	retval = !stat(path, &buf);
    1.21 -	free(path);
    1.22  	if (retval) {
    1.23  		fprintf(stderr,
    1.24  			"a razor install root is already initialized\n");
    1.25 +		free(path);
    1.26 +		free(file);
    1.27  		return retval;
    1.28  	}
    1.29  
    1.30  	atomic = razor_atomic_open("Create initial package set");
    1.31 -	path = razor_concat(razor_root_path, "/", system_repo_filename, NULL);
    1.32 -	razor_atomic_make_dirs(atomic, root, path);
    1.33 +	razor_atomic_make_dirs(atomic, root, file);
    1.34  	set = razor_set_create();
    1.35  	razor_set_write(set, atomic, path, RAZOR_SECTION_ALL);
    1.36  	free(path);
    1.37 +	free(file);
    1.38  	retval = razor_atomic_commit(atomic);
    1.39  	if (retval)
    1.40  		fprintf(stderr, "could not write initial package set\n");