summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/be_local.c38
-rw-r--r--lib/libalpm/conflict.c3
-rw-r--r--lib/libalpm/group.c2
-rw-r--r--lib/libalpm/handle.c5
-rw-r--r--lib/libalpm/package.c2
-rw-r--r--lib/libalpm/package.h2
6 files changed, 25 insertions, 27 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 39df15b0..aab6718f 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -783,7 +783,8 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
/* DESC */
if(inforeq & INFRQ_DESC) {
char *path;
- _alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s DESC information back to db\n",
+ _alpm_log(db->handle, ALPM_LOG_DEBUG,
+ "writing %s-%s DESC information back to db\n",
info->name, info->version);
path = _alpm_local_db_pkgpath(db, info, "desc");
if(!path || (fp = fopen(path, "w")) == NULL) {
@@ -800,26 +801,10 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
fprintf(fp, "%%DESC%%\n"
"%s\n\n", info->desc);
}
- if(info->groups) {
- fputs("%GROUPS%\n", fp);
- for(lp = info->groups; lp; lp = lp->next) {
- fputs(lp->data, fp);
- fputc('\n', fp);
- }
- fputc('\n', fp);
- }
if(info->url) {
fprintf(fp, "%%URL%%\n"
"%s\n\n", info->url);
}
- if(info->licenses) {
- fputs("%LICENSE%\n", fp);
- for(lp = info->licenses; lp; lp = lp->next) {
- fputs(lp->data, fp);
- fputc('\n', fp);
- }
- fputc('\n', fp);
- }
if(info->arch) {
fprintf(fp, "%%ARCH%%\n"
"%s\n\n", info->arch);
@@ -845,6 +830,22 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
fprintf(fp, "%%REASON%%\n"
"%u\n\n", info->reason);
}
+ if(info->groups) {
+ fputs("%GROUPS%\n", fp);
+ for(lp = info->groups; lp; lp = lp->next) {
+ fputs(lp->data, fp);
+ fputc('\n', fp);
+ }
+ fputc('\n', fp);
+ }
+ if(info->licenses) {
+ fputs("%LICENSE%\n", fp);
+ for(lp = info->licenses; lp; lp = lp->next) {
+ fputs(lp->data, fp);
+ fputc('\n', fp);
+ }
+ fputc('\n', fp);
+ }
if(info->validation) {
fputs("%VALIDATION%\n", fp);
if(info->validation & ALPM_PKG_VALIDATION_NONE) {
@@ -875,7 +876,8 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
/* FILES */
if(inforeq & INFRQ_FILES) {
char *path;
- _alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
+ _alpm_log(db->handle, ALPM_LOG_DEBUG,
+ "writing %s-%s FILES information back to db\n",
info->name, info->version);
path = _alpm_local_db_pkgpath(db, info, "files");
if(!path || (fp = fopen(path, "w")) == NULL) {
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 85429029..5714932c 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -547,7 +547,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
* consideration cannot itself be a link, as it might be unowned- path
* components can be safely checked as all directories are "unowned". */
if(!resolved_conflict && dbpkg && !S_ISLNK(lsbuf.st_mode)) {
- char *rpath = calloc(PATH_MAX, sizeof(char));
+ char rpath[PATH_MAX];
if(realpath(path, rpath)) {
const char *relative_rpath = rpath + rootlen;
if(_alpm_filelist_contains(alpm_pkg_get_files(dbpkg), relative_rpath)) {
@@ -556,7 +556,6 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
resolved_conflict = 1;
}
}
- free(rpath);
}
/* is the file unowned and in the backup list of the new package? */
diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c
index 4f4d8ce0..7c3d64f7 100644
--- a/lib/libalpm/group.c
+++ b/lib/libalpm/group.c
@@ -30,7 +30,7 @@
alpm_group_t *_alpm_group_new(const char *name)
{
- alpm_group_t* grp;
+ alpm_group_t *grp;
CALLOC(grp, 1, sizeof(alpm_group_t), return NULL);
STRDUP(grp->name, name, free(grp); return NULL);
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 2db27fbf..816162bd 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -333,7 +333,7 @@ alpm_errno_t _alpm_set_directory_option(const char *value,
char **storage, int must_exist)
{
struct stat st;
- char *real = NULL;
+ char real[PATH_MAX];
const char *path;
path = value;
@@ -344,9 +344,7 @@ alpm_errno_t _alpm_set_directory_option(const char *value,
if(stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
return ALPM_ERR_NOT_A_DIR;
}
- CALLOC(real, PATH_MAX, sizeof(char), return ALPM_ERR_MEMORY);
if(!realpath(path, real)) {
- free(real);
return ALPM_ERR_NOT_A_DIR;
}
path = real;
@@ -359,7 +357,6 @@ alpm_errno_t _alpm_set_directory_option(const char *value,
if(!*storage) {
return ALPM_ERR_MEMORY;
}
- free(real);
return 0;
}
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index a1d75a75..46d14731 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -461,7 +461,7 @@ int _alpm_files_cmp(const void *f1, const void *f2)
alpm_pkg_t *_alpm_pkg_new(void)
{
- alpm_pkg_t* pkg;
+ alpm_pkg_t *pkg;
CALLOC(pkg, 1, sizeof(alpm_pkg_t), return NULL);
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index be779b46..c473549a 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -128,7 +128,7 @@ struct __alpm_pkg_t {
alpm_file_t *_alpm_file_copy(alpm_file_t *dest, const alpm_file_t *src);
int _alpm_files_cmp(const void *f1, const void *f2);
-alpm_pkg_t* _alpm_pkg_new(void);
+alpm_pkg_t *_alpm_pkg_new(void);
int _alpm_pkg_dup(alpm_pkg_t *pkg, alpm_pkg_t **new_ptr);
void _alpm_pkg_free(alpm_pkg_t *pkg);
void _alpm_pkg_free_trans(alpm_pkg_t *pkg);