Create rpms dir on demand.
authorKristian H?gsberg <krh@jiraiya.boston.redhat.com>
Mon Apr 07 21:29:21 2008 -0400 (2008-04-07)
changeset 20675d4b6a55593
parent 205 bb1a6b6578a9
child 207 b7d55f3fa183
Create rpms dir on demand.
main.c
     1.1 --- a/main.c	Mon Apr 07 12:38:21 2008 -0400
     1.2 +++ b/main.c	Mon Apr 07 21:29:21 2008 -0400
     1.3 @@ -9,6 +9,7 @@
     1.4  #include <dirent.h>
     1.5  #include <curl/curl.h>
     1.6  #include <fnmatch.h>
     1.7 +#include <errno.h>
     1.8  #include "razor.h"
     1.9  #include "razor-internal.h"
    1.10  
    1.11 @@ -597,6 +598,11 @@
    1.12  	razor_set_write_to_fd(next, fd);
    1.13  	printf("wrote %s\n", new_path);
    1.14  
    1.15 +	if (mkdir("rpms", 0777) && errno != EEXIST) {
    1.16 +		fprintf(stderr, "failed to create rpms directory.\n");
    1.17 +		return 1;
    1.18 +	}
    1.19 +
    1.20  	razor_set_diff(system, next, download_package, &errors);
    1.21  	if (errors > 0) {
    1.22  		fprintf(stderr, "failed to download %d packages\n", errors);
    1.23 @@ -669,6 +675,11 @@
    1.24  	char url[256], file[256];
    1.25  	int matches = 0;
    1.26  
    1.27 +	if (mkdir("rpms", 0777) && errno != EEXIST) {
    1.28 +		fprintf(stderr, "failed to create rpms directory.\n");
    1.29 +		return 1;
    1.30 +	}
    1.31 +
    1.32  	set = razor_set_open(rawhide_repo_filename);
    1.33  	pi = razor_package_iterator_create(set);
    1.34  	while (razor_package_iterator_next(pi, &package,