diff options
author | Richard Hughes <richard@hughsie.com> | 2008-06-30 10:46:20 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2008-06-30 10:46:20 +0100 |
commit | e911090d427fcf3cf57fa57d51c65cf724be770d (patch) | |
tree | 97b992368840d25e3a5d9d9cc4ed2e5c1895c6e7 /src/main.c | |
parent | d66068c79b8bb9173a3fa6dc5baf78ed1c9861de (diff) |
the vararg list must be terminated with zero else 64bit machines may crash
On 64 bit systems, the integer 0 is 32 bits and the pointer 0 is 64 bits.
The upper 32 bits will not be cleared and the loop will never terminate.
Also add the RAZOR_SENTINEL __attribute__ ((__sentinel__(0))) on GCC4
so we catch where we get this wrong automatically.
This also fixes the new search functionality from James which was missed
in the merge.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 31 |
1 files changed, 18 insertions, 13 deletions
@@ -59,7 +59,7 @@ create_iterator_from_argv(struct razor_set *set, int argc, const char *argv[]) iter = razor_package_iterator_create(set); pattern = argv[i]; count = 0; - while (razor_package_iterator_next(iter, &package, RAZOR_DETAIL_NAME, &name, 0)) { + while (razor_package_iterator_next(iter, &package, RAZOR_DETAIL_NAME, &name, NULL)) { if (fnmatch(pattern, name, 0) != 0) continue; @@ -87,7 +87,7 @@ list_packages(struct razor_package_iterator *iter, uint32_t flags) while (razor_package_iterator_next(iter, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, 0)) { + RAZOR_DETAIL_ARCH, &arch, NULL)) { if (flags & LIST_PACKAGES_ONLY_NAMES) printf("%s\n", name); else @@ -431,7 +431,7 @@ mark_packages_for_update(struct razor_transaction *trans, pi = razor_package_iterator_create(set); while (razor_package_iterator_next(pi, &package, - RAZOR_DETAIL_NAME, &name, 0)) { + RAZOR_DETAIL_NAME, &name, NULL)) { if (pattern && fnmatch(pattern, name, 0) == 0) { razor_transaction_update_package(trans, package); matches++; @@ -452,7 +452,7 @@ mark_packages_for_removal(struct razor_transaction *trans, int matches = 0; pi = razor_package_iterator_create(set); - while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, 0)) { + while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, NULL)) { if (pattern && fnmatch(pattern, name, 0) == 0) { razor_transaction_remove_package(trans, package); matches++; @@ -662,7 +662,7 @@ download_packages(struct razor_set *system, struct razor_set *next) while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, 0)) { + RAZOR_DETAIL_ARCH, &arch, NULL)) { snprintf(url, sizeof url, "%s/Packages/%s", yum_url, rpm_filename(name, version, arch)); @@ -694,7 +694,7 @@ install_packages(struct razor_set *system, struct razor_set *next) while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, 0)) { + RAZOR_DETAIL_ARCH, &arch, NULL)) { printf("install %s-%s\n", name, version); snprintf(file, sizeof file, @@ -802,7 +802,7 @@ command_download(int argc, const char *argv[]) while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, 0)) { + RAZOR_DETAIL_ARCH, &arch, NULL)) { if (pattern && fnmatch(pattern, name, 0) != 0) continue; @@ -845,7 +845,7 @@ command_info(int argc, const char *argv[]) while (razor_package_iterator_next(pi, &package, RAZOR_DETAIL_NAME, &name, RAZOR_DETAIL_VERSION, &version, - RAZOR_DETAIL_ARCH, &arch, 0)) { + RAZOR_DETAIL_ARCH, &arch, NULL)) { if (pattern && fnmatch(pattern, name, 0) != 0) continue; @@ -854,7 +854,7 @@ command_info(int argc, const char *argv[]) RAZOR_DETAIL_DESCRIPTION, &description, RAZOR_DETAIL_URL, &url, RAZOR_DETAIL_LICENSE, &license, - 0); + NULL); printf ("Name: %s\n", name); printf ("Arch: %s\n", arch); @@ -899,13 +899,18 @@ command_search(int argc, const char *argv[]) pi = razor_package_iterator_create(set); while (razor_package_iterator_next(pi, &package, - &name, &version, &arch)) { + RAZOR_DETAIL_NAME, &name, + RAZOR_DETAIL_VERSION, &version, + RAZOR_DETAIL_ARCH, &arch, NULL)) { if (!fnmatch(pattern, name, 0)) printf("%s-%s.%s\n", name, version, arch); else { - razor_package_get_details (set, package, &summary, - &description, &url, - &license); + razor_package_get_details (set, package, + RAZOR_DETAIL_SUMMARY, &summary, + RAZOR_DETAIL_DESCRIPTION, &description, + RAZOR_DETAIL_URL, &url, + RAZOR_DETAIL_LICENSE, &license, + NULL); if (!fnmatch(pattern, url, 0) || !fnmatch(pattern, summary, 0) || !fnmatch(pattern, description, 0)) |