diff options
author | Xavier Chantry <shiningxc@gmail.com> | 2009-12-05 01:50:09 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-03-15 01:25:48 +0100 |
commit | 1aa1d00248ac89fb02e762b96c58559a04679b2e (patch) | |
tree | 0326bf37268fa6167f4b17e38b58bda598a82da4 /lib | |
parent | be2f43191d0d0cdf02d72ac72a013697b0f7e879 (diff) | |
download | pacman-1aa1d00248ac89fb02e762b96c58559a04679b2e.tar.gz pacman-1aa1d00248ac89fb02e762b96c58559a04679b2e.tar.xz |
fix a few warnings reported by clang
- remove unused variables
- some more sanity checks
- safer printf
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/add.c | 2 | ||||
-rw-r--r-- | lib/libalpm/be_files.c | 2 | ||||
-rw-r--r-- | lib/libalpm/conflict.c | 2 | ||||
-rw-r--r-- | lib/libalpm/package.c | 3 |
4 files changed, 5 insertions, 4 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index ebcd6a55..dc565ac6 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -483,6 +483,8 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count, ALPM_LOG_FUNC; + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + snprintf(scriptlet, PATH_MAX, "%s%s-%s/install", _alpm_db_path(db), alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg)); diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index bfcea188..4ddb1369 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -140,8 +140,8 @@ static int dirlist_from_fs(const char *syncdbpath, alpm_list_t **dirlist) entry[len+1] = '\0'; *dirlist = alpm_list_add(*dirlist, entry); } + closedir(dbdir); } - closedir(dbdir); *dirlist = alpm_list_msort(*dirlist, alpm_list_count(*dirlist), _alpm_str_cmp); return(0); diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index e934c01e..85db83ba 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -408,7 +408,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, ALPM_LOG_FUNC; - if(db == NULL || upgrade == NULL) { + if(db == NULL || upgrade == NULL || trans == NULL) { return(NULL); } diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 4ff04dab..ef0f63a2 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -459,7 +459,6 @@ void SYMEXPORT *alpm_pkg_changelog_open(pmpkg_t *pkg) struct archive *archive = NULL; struct archive_entry *entry; const char *pkgfile = pkg->origin_data.file; - int ret = ARCHIVE_OK; if((archive = archive_read_new()) == NULL) { RET_ERR(PM_ERR_LIBARCHIVE, NULL); @@ -473,7 +472,7 @@ void SYMEXPORT *alpm_pkg_changelog_open(pmpkg_t *pkg) RET_ERR(PM_ERR_PKG_OPEN, NULL); } - while((ret = archive_read_next_header(archive, &entry)) == ARCHIVE_OK) { + while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) { const char *entry_name = archive_entry_pathname(entry); if(strcmp(entry_name, ".CHANGELOG") == 0) { |