From: Michael Tremer Date: Tue, 22 Jun 2021 13:49:56 +0000 (+0000) Subject: build: Use CWD if no local repository could be found X-Git-Tag: 0.9.28~1199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cee6363ad2de1586d785db106c22a61158c86aec;p=pakfire.git build: Use CWD if no local repository could be found Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/build.c b/src/libpakfire/build.c index df08545b7..1ddff8a21 100644 --- a/src/libpakfire/build.c +++ b/src/libpakfire/build.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -844,6 +845,7 @@ PAKFIRE_EXPORT int pakfire_build(Pakfire pakfire, const char* path, const char* target, const char* id, int flags, pakfire_execute_logging_callback logging_callback, void* data) { char makefiles[PATH_MAX]; + char cwd[PATH_MAX]; char* generated_id = NULL; glob_t buffer; int r = 1; @@ -857,13 +859,14 @@ PAKFIRE_EXPORT int pakfire_build(Pakfire pakfire, const char* path, // The default target is the local repository path if (!target) { PakfireRepo repo = pakfire_get_repo(pakfire, "@local"); - if (!repo) { - errno = EINVAL; - return 1; - } + if (repo) { + target = pakfire_repo_get_path(repo); + pakfire_repo_unref(repo); - target = pakfire_repo_get_path(repo); - pakfire_repo_unref(repo); + // If the repository could not be found, just write to the cwd + } else { + target = getcwd(cwd, sizeof(cwd)); + } } // If no build ID was passed, we generate a random one