summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2008-06-30 10:46:20 +0100
committerRichard Hughes <richard@hughsie.com>2008-06-30 10:46:20 +0100
commite911090d427fcf3cf57fa57d51c65cf724be770d (patch)
tree97b992368840d25e3a5d9d9cc4ed2e5c1895c6e7 /src
parentd66068c79b8bb9173a3fa6dc5baf78ed1c9861de (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')
-rw-r--r--src/main.c31
-rw-r--r--src/rpm.c14
2 files changed, 25 insertions, 20 deletions
diff --git a/src/main.c b/src/main.c
index 56b3b2c..7fd0f51 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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))
diff --git a/src/rpm.c b/src/rpm.c
index 76f2414..f752aa9 100644
--- a/src/rpm.c
+++ b/src/rpm.c
@@ -313,7 +313,7 @@ add_command_line_packages(struct razor_set *set,
pi = razor_package_iterator_create(set);
while (razor_package_iterator_next(pi, &package,
- RAZOR_DETAIL_NAME, &name, 0)) {
+ RAZOR_DETAIL_NAME, &name, NULL)) {
while (cmp = strcmp(argv[i], name), cmp < 0 && i < argc) {
fprintf(stderr, "error: package %s is not installed\n",
argv[i]);
@@ -422,7 +422,7 @@ print_package_info(struct razor_set *set, struct razor_package *package,
RAZOR_DETAIL_DESCRIPTION, &description,
RAZOR_DETAIL_URL, &url,
RAZOR_DETAIL_LICENSE, &license,
- 0);
+ NULL);
printf("Name: %s\n", name);
printf("Arch: %s\n", arch);
@@ -494,7 +494,7 @@ command_query(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 (option_conflicts)
print_package_properties(set, package,
RAZOR_PROPERTY_CONFLICTS);
@@ -548,7 +548,7 @@ command_verify(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)) {
printf("verify %s-%s.%s - not implemented\n",
name, version, arch);
}
@@ -593,7 +593,7 @@ command_erase(int argc, const char *argv[])
add_command_line_packages(set, query, argc, argv);
pi = razor_package_query_finish(query);
- while (razor_package_iterator_next(pi, &package, 0))
+ while (razor_package_iterator_next(pi, &package, NULL))
razor_transaction_remove_package(trans, package);
razor_package_iterator_destroy(pi);
@@ -635,7 +635,7 @@ command_install(int argc, const char *argv[])
trans = razor_transaction_create(set, upstream);
pi = razor_package_iterator_create(upstream);
- while (razor_package_iterator_next(pi, &package, 0))
+ while (razor_package_iterator_next(pi, &package, NULL))
razor_transaction_install_package(trans, package);
razor_package_iterator_destroy(pi);
@@ -677,7 +677,7 @@ command_update(int argc, const char *argv[])
trans = razor_transaction_create(set, upstream);
pi = razor_package_iterator_create(upstream);
- while (razor_package_iterator_next(pi, &package, 0))
+ while (razor_package_iterator_next(pi, &package, NULL))
razor_transaction_update_package(trans, package);
razor_package_iterator_destroy(pi);