Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
fix crashing with pkg repo <non exist dir>
Andrej Zverev committed 13 years ago
commit 1918f490de78b6e7d1d8965de1efb4d8731291ae
parent ea7b1cd15e03a56c1c14db8abb4e42fb61cdf16f
3 files changed +15 -5
modified libpkg/pkg_repo.c
@@ -650,6 +650,11 @@ pkg_finish_repo(char *path, pem_password_cb *password_cb, char *rsa_key_path)
	struct packing *pack;
	unsigned char *sigret = NULL;
	unsigned int siglen = 0;
+
	
+
	if (!is_dir(path)) {
+
	    pkg_emit_error("%s is not a directory", path);
+
	    return EPKG_FATAL;
+
	}

	snprintf(repo_path, sizeof(repo_path), "%s/repo.sqlite", path);
	snprintf(repo_archive, sizeof(repo_archive), "%s/repo", path);
modified pkg/main.c
@@ -173,6 +173,9 @@ main(int argc, char **argv)
	const char *buf = NULL;
	bool b;
	struct pkg_config_kv *kv = NULL;
+
	
+
	// Set stdout unbuffered
+
        setvbuf(stdout, NULL, _IONBF, 0);

	if (argc < 2)
		usage();
modified pkg/repo.c
@@ -95,14 +95,16 @@ exec_repo(int argc, char **argv)
		return (EX_USAGE);
	}

-
	printf("Generating repo.sqlite in %s:  ", argv[1]);
	retcode = pkg_create_repo(argv[1], progress, &pos);
+
	printf("Generating repo.sqlite in %s:  ", argv[1]);

-
	if (retcode != EPKG_OK)
+
	if (retcode != EPKG_OK) {
		printf("can not create repository");
-
	else
-
		printf("\bDone!\n");
-

+
		return (retcode);
+
	} else {
+
		printf("\bdone!\n");
+
	}
+
	
	rsa_key = (argc == 3) ? argv[2] : NULL;
	pkg_finish_repo(argv[1], password_cb, rsa_key);