Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Clang cleanups.
jlaffaye committed 15 years ago
commit 414f58eb2677f5a23b28d8e5f30c550dc12eac98
parent 2220806f24f2d51cc18cc00b754a54a3882f2437
2 files changed +9 -7
modified libpkg/pkg.c
@@ -53,7 +53,7 @@ pkg_create_from_dir(char *path, const char *root, struct archive *pkg_archive)
			archive_entry_copy_sourcepath(entry, g.gl_pathv[i]);

			if (archive_read_disk_entry_from_file(ar, entry, -1, 0) != ARCHIVE_OK)
-
				warnx(archive_error_string(ar));
+
				warnx("archive_read_disk_entry_from_file(): %s", archive_error_string(ar));

			archive_entry_set_pathname(entry, basename(g.gl_pathv[i]));
			archive_write_header(pkg_archive, entry);
@@ -72,7 +72,7 @@ pkg_create_from_dir(char *path, const char *root, struct archive *pkg_archive)

	archive_entry_copy_sourcepath(entry, mpath);
	if (archive_read_disk_entry_from_file(ar, entry, -1, 0) != ARCHIVE_OK)
-
		warnx(archive_error_string(ar));
+
		warnx("archive_read_disk_entry_form_file(): %s", archive_error_string(ar));

	archive_entry_set_pathname(entry, "+MANIFEST");
	archive_entry_set_size(entry, buffer_len);
@@ -89,7 +89,7 @@ pkg_create_from_dir(char *path, const char *root, struct archive *pkg_archive)
		archive_entry_copy_sourcepath(entry, filepath);

		if (archive_read_disk_entry_from_file(ar, entry, -1, 0) != ARCHIVE_OK)
-
			warnx(archive_error_string(ar));
+
			warnx("archive_read_disk_entry_from_file(): %s", archive_error_string(ar));

		archive_entry_set_pathname(entry, filepath);
		archive_write_header(pkg_archive, entry);
@@ -167,7 +167,7 @@ pkg_create(char *pkgname, pkg_formats format, const char *outdir, const char *ro
			break;
		case TXZ:
			if (archive_write_set_compression_lzma(pkg_archive) != ARCHIVE_OK) {
-
				warnx(archive_error_string(pkg_archive));
+
				warnx("%s", archive_error_string(pkg_archive));
			}
			break;
	}
modified pkg/main.c
@@ -35,7 +35,7 @@ main(int argc, char **argv)
{
	int i;
	struct commands *command = NULL;
-
	int ambiguous = 0;
+
	int ambiguous = -1;
	size_t len;

	if (argc < 2)
@@ -45,7 +45,7 @@ main(int argc, char **argv)
	for (i = 0; cmd[i].name != NULL; i++) {
		if (strncmp(argv[1], cmd[i].name, len) == 0) {
			/* if we have the exact cmd */
-
			if (len == sizeof(cmd[i].name) - 1) {
+
			if (len == strlen(cmd[i].name)) {
				command = &cmd[i];
				ambiguous = 0;
				break;
@@ -53,10 +53,12 @@ main(int argc, char **argv)

			/*
			 * we already found a partial match so `argv[1]' is
-
			 * an ambigous shortcut
+
			 * an ambiguous shortcut
			 */
			if (command != NULL)
				ambiguous = 1;
+
			else
+
				ambiguous = 0;

			command = &cmd[i];
		}