summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-10-08 21:25:52 -0500
committerDan McGee <dan@archlinux.org>2007-10-08 21:25:52 -0500
commit6db0562b8d3cda777650521f1205a541d0e0aa93 (patch)
tree5a85048cde8e8b45b1e20fc947a70730b841c9f5
parent087b8df781fb229033e9c01f58cdf80f0ddd29e6 (diff)
downloadpacman-6db0562b8d3cda777650521f1205a541d0e0aa93.tar.xz
Add gcc format attribute to _alpm_log, catch a few bugs in the process
This fixed a few of our formatted output strings that were broken before but never being checked. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/db.c4
-rw-r--r--lib/libalpm/log.h2
-rw-r--r--lib/libalpm/remove.c2
-rw-r--r--lib/libalpm/sync.c6
4 files changed, 8 insertions, 6 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index b06a970c..1052840f 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -278,7 +278,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
snprintf(path, PATH_MAX, "%s%s" DBEXT, dbpath, db->treename);
/* remove the old dir */
- _alpm_log(PM_LOG_DEBUG, "flushing database %s%s\n", db->path);
+ _alpm_log(PM_LOG_DEBUG, "flushing database %s\n", db->path);
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
pmpkg_t *pkg = lp->data;
if(pkg && _alpm_db_remove(db, pkg) == -1) {
@@ -461,7 +461,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_upgrades(void)
if(strcmp(k->data, alpm_pkg_get_name(lpkg)) == 0) {
_alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'\n",
- k->data, alpm_pkg_get_name(spkg));
+ (char *)k->data, alpm_pkg_get_name(spkg));
if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(lpkg))) {
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"),
alpm_pkg_get_name(lpkg), alpm_pkg_get_version(lpkg),
diff --git a/lib/libalpm/log.h b/lib/libalpm/log.h
index abb160d5..00fabf47 100644
--- a/lib/libalpm/log.h
+++ b/lib/libalpm/log.h
@@ -30,7 +30,7 @@
#define ALPM_LOG_FUNC
#endif
-void _alpm_log(pmloglevel_t flag, char *fmt, ...);
+void _alpm_log(pmloglevel_t flag, char *fmt, ...) __attribute__((format(printf,2,3)));
#endif /* _ALPM_LOG_H */
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 07fd0235..734c365c 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -242,7 +242,7 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, pmtrans_t *trans)
if(unlink(file) == -1) {
_alpm_log(PM_LOG_ERROR, _("cannot remove file '%s': %s\n"),
- lp->data, strerror(errno));
+ (char *)lp->data, strerror(errno));
}
}
}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index f21f7d35..d24a1e52 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -281,7 +281,8 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
if(!p) {
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
- _alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'\n", p->data, targ);
+ _alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'\n",
+ (char *)p->data, targ);
spkg = _alpm_db_get_pkgfromcache(db, p->data);
alpm_list_free(p);
}
@@ -304,7 +305,8 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
pmdb_t *db = j->data;
alpm_list_t *p = _alpm_db_whatprovides(db, targ);
if(p) {
- _alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'\n", p->data, targ);
+ _alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'\n",
+ (char *)p->data, targ);
spkg = _alpm_db_get_pkgfromcache(db, p->data);
alpm_list_free(p);
}