[PATCH] fdi cache regen logic error

Doug Goldstein cardoe at gentoo.org
Wed Apr 11 09:19:59 PDT 2007


Doug Goldstein wrote:
> There's a logic error in the check of the return from fdi cache regen.
> Basically if exit_type wasn't HALD_RUN_SUCCESS (which is defined as 0)
> or return_code isn't 0 or 2, then an error occurred. Based on the order
> users would have the following in their logs.
>
> 12:54:13.827 [I] mmap_cache.c:137: In regen_cache_cb exit_type=0, return_code=0
> 12:54:13.827 [E] mmap_cache.c:190: fdi cache regeneration failed!
>
> The following patch corrects the issue and should be applied to 0.5.9 branch as well.
>
>
>   
> ------------------------------------------------------------------------
>
> Index: b/hald/mmap_cache.c
> ===================================================================
> --- a/hald/mmap_cache.c	2007-03-07 16:55:02.000000000 -0500
> +++ b/hald/mmap_cache.c	2007-04-10 10:56:10.000000000 -0400
> @@ -137,7 +137,7 @@
>  	HAL_INFO (("In regen_cache_cb exit_type=%d, return_code=%d", exit_type, return_code));
>  
>  	/* see create_cache.c - rc==0 means success - rc==2 means "success, but some fdi files skipped" */
> -	if (exit_type != HALD_RUN_SUCCESS || return_code != 0 || return_code != 2) {
> +	if (exit_type != HALD_RUN_SUCCESS || ( return_code != 0 && return_code != 2)) {
>  		regen_cache_success = FALSE;
>  	} else {
>  		regen_cache_success = TRUE;
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> hal mailing list
> hal at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/hal
>   
I know I'm replying to myself...

But personally I usually prefer to catch the cases I know are successful
and let all other cases fail over..

Attached is the patch to go in that direction.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 04_cache_regen_return_fix.patch
Type: text/x-patch
Size: 740 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20070411/1e410cf8/04_cache_regen_return_fix.bin


More information about the hal mailing list