[pacman-dev] [PATCH] avoid segfaults whet calling alpm_option_get_* without previously calling alpm_initialize()

Dan McGee dpmcgee at gmail.com
Mon Sep 17 23:03:30 EDT 2007


On 9/11/07, Stefano Esposito <stefano.esposito87 at gmail.com> wrote:
> When calling a function of the alpm_option_get_* group, you get a segfault if you don't call alpm_initialize() first. With this patch those functions set pm_errno to PM_ERR_HANDLE_NULL and return an error value if handle == NULL. Patch attached
>
> Signed-off-by: Stefano Esposito <stefano.esposito87 at gmail.com>
> ---
>   lib/libalpm/handle.c |  165 ++++++++++++++++++++++++++++++++++++++++++++------
>   1 files changed, 146 insertions(+), 19 deletions(-)
>
> --
> Stefano Esposito <stefano.esposito87 at gmail.com>

Thanks for the patch. I applied it with a few changes:
1. Updated it to follow the pacman coding standards- the opening brace
of a function goes on the next line.
(http://www.archlinux.org/~aaron/pacman-coding.html)
2. Removed extra whitespace that your editor added or something. I
recommend chmodding +x the pre-commit GIT hook to check for things
like this.

Thanks for the contribution though- try to keep these small points in
mind next time.

-Dan




More information about the pacman-dev mailing list