[pacman-dev] [PATCH] Size handling was changed in fgets() functions

Allan McRae allan at archlinux.org
Sun Sep 20 09:21:19 EDT 2009


Laszlo Papp wrote:
>     ./src/pacman/util.c:
>         - response size handling was changed in fgets() function, because
>         it's easier to handle the source modification after a size modification
>     ./lib/libalp/be_files.c:
>         - line size handling was changed in fgets() function, because
>         it's easier to handle the source code after a size modification
>     ./lib/libalpm/trans.c:
>         - line size handling was changed in fgets() function, because
>         it's easier to handle the source code after a size modification
>   

Your commit messages really do not tell me much...  and in this case are 
quite repetitive.


> <snip>
> diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
> index c99f596..c182510 100644
> --- a/lib/libalpm/trans.c
> +++ b/lib/libalpm/trans.c
> @@ -320,7 +320,7 @@ static int grep(const char *fn, const char *needle)
>  	}
>  	while(!feof(fp)) {
>  		char line[1024];
> -		fgets(line, 1024, fp);
> +		fgets(line, sizeof(line), fp);
>  		if(feof(fp)) {
>  			continue;
>  		}

This highlights my concerns.  We are removing a known size and instead 
recalculating it.  What is the advantage of this?

Allan



More information about the pacman-dev mailing list