summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_files.c
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-01-24 08:51:50 +0000
committerAaron Griffin <aaron@archlinux.org>2007-01-24 08:51:50 +0000
commit170d63190a3cfb0c12ee9ddfe07b21f20825bd6f (patch)
treec1cad21e75daf695f61f83ca1072d0a52343a673 /lib/libalpm/be_files.c
parent1b61cc8c69025ddd394401a506b21f16df5d4e6d (diff)
downloadpacman-170d63190a3cfb0c12ee9ddfe07b21f20825bd6f.tar.xz
* Shuffled some of the alpm_list free funtions - still not perfect, but better
* Added alpm_list_remove_node for single list node removal * Proper error checking/output for failed db_read/db_write (missing files) * Invalid packages (missing files) are now removed from the package cache * -Qs and -Ss output now look the same * config.rpath causes errors on one machine I had, so I added it to CVS * Fixed a "clobbered memory" issue when installing groups - only the outer list should be free'd, not the contained data
Diffstat (limited to 'lib/libalpm/be_files.c')
-rw-r--r--lib/libalpm/be_files.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 19e2bf1f..65a5fc71 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -217,9 +217,8 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
/* DESC */
if(inforeq & INFRQ_DESC) {
snprintf(path, PATH_MAX, "%s/%s-%s/desc", db->path, info->name, info->version);
- fp = fopen(path, "r");
- if(fp == NULL) {
- _alpm_log(PM_LOG_DEBUG, "%s (%s)", path, strerror(errno));
+ if((fp = fopen(path, "r")) == NULL) {
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
@@ -362,9 +361,8 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
/* FILES */
if(inforeq & INFRQ_FILES) {
snprintf(path, PATH_MAX, "%s/%s-%s/files", db->path, info->name, info->version);
- fp = fopen(path, "r");
- if(fp == NULL) {
- _alpm_log(PM_LOG_WARNING, "%s (%s)", path, strerror(errno));
+ if((fp = fopen(path, "r")) == NULL) {
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
goto error;
}
while(fgets(line, 256, fp)) {
@@ -386,9 +384,8 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
/* DEPENDS */
if(inforeq & INFRQ_DEPENDS) {
snprintf(path, PATH_MAX, "%s/%s-%s/depends", db->path, info->name, info->version);
- fp = fopen(path, "r");
- if(fp == NULL) {
- _alpm_log(PM_LOG_WARNING, "%s (%s)", path, strerror(errno));
+ if((fp = fopen(path, "r")) == NULL) {
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
@@ -474,8 +471,8 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
_alpm_log(PM_LOG_DEBUG, _("writing %s-%s DESC information back to db"), info->name, info->version);
snprintf(path, PATH_MAX, "%s/%s-%s/desc", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("db_write: could not open file %s/desc"), db->treename);
- retval = 1;
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
+ retval = -1;
goto cleanup;
}
fprintf(fp, "%%NAME%%\n%s\n\n"
@@ -560,7 +557,7 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
_alpm_log(PM_LOG_DEBUG, _("writing %s-%s FILES information back to db"), info->name, info->version);
snprintf(path, PATH_MAX, "%s/%s-%s/files", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("db_write: could not open file %s/files"), db->treename);
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
retval = -1;
goto cleanup;
}
@@ -587,7 +584,7 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
_alpm_log(PM_LOG_DEBUG, _("writing %s-%s DEPENDS information back to db"), info->name, info->version);
snprintf(path, PATH_MAX, "%s/%s-%s/depends", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("db_write: could not open file %s/depends"), db->treename);
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
retval = -1;
goto cleanup;
}