From 7b7f7677945609a6b0015e471c272a9c2ebebb8e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 7 Apr 2008 21:28:13 -0400 Subject: [PATCH] Create rpms dir on demand. --- main.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/main.c b/main.c index 24e6293..cb817b1 100644 --- a/main.c +++ b/main.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "razor.h" #include "razor-internal.h" @@ -597,6 +598,11 @@ command_install(int argc, const char *argv[]) razor_set_write_to_fd(next, fd); printf("wrote %s\n", new_path); + if (mkdir("rpms", 0777) && errno != EEXIST) { + fprintf(stderr, "failed to create rpms directory.\n"); + return 1; + } + razor_set_diff(system, next, download_package, &errors); if (errors > 0) { fprintf(stderr, "failed to download %d packages\n", errors); @@ -669,6 +675,11 @@ command_download(int argc, const char *argv[]) char url[256], file[256]; int matches = 0; + if (mkdir("rpms", 0777) && errno != EEXIST) { + fprintf(stderr, "failed to create rpms directory.\n"); + return 1; + } + set = razor_set_open(rawhide_repo_filename); pi = razor_package_iterator_create(set); while (razor_package_iterator_next(pi, &package, -- 1.7.1