diff options
author | Dan McGee <dan@archlinux.org> | 2011-08-19 11:06:55 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-08-19 11:09:57 -0500 |
commit | 6d544984f2418ea34caab4c433580487b760362a (patch) | |
tree | cf0510b97a6495587c87598a70bf8761189f5c32 /lib/libalpm/package.h | |
parent | 9934b3bd345011eef6a96249d8d90de594c04cd0 (diff) | |
download | pacman-6d544984f2418ea34caab4c433580487b760362a.tar.xz |
Be more robust when copying package data
This changes the signature of _alpm_pkg_dup() to return an integer error
code and provide the new package in a passed pointer argument. All
callers are now more robust with checking the return value of this
function to ensure a fatal error did not occur.
We allow load failures to proceed as otherwise we have a chicken and egg
problem- if a 'desc' local database entry is missing, the best way of
restoring said file is `pacman -Sf --dbonly packagename`. This patch
fixes a segfault that was occurring in this case.
Fixes the segfault reported in FS#25667.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/package.h')
-rw-r--r-- | lib/libalpm/package.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index bb92ddc2..25d1b1a6 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -144,7 +144,7 @@ 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_dup(alpm_pkg_t *pkg); +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); |