Re: [PATCH] fix virLogCleanerParseFilename logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/19/24 17:40, David Negreira wrote:
> We should return the full filename path when we don't have a match on
> the third group of the regex.
> 
> Signed-off-by: David Negreira <david.negreira@xxxxxxxxxxxxx>
> ---
>  src/logging/log_cleaner.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/logging/log_cleaner.c b/src/logging/log_cleaner.c
> index 4ee91843aa..d8e6ce9cdd 100644
> --- a/src/logging/log_cleaner.c
> +++ b/src/logging/log_cleaner.c
> @@ -82,7 +82,7 @@ virLogCleanerParseFilename(const char *path,
>      *rotated_index = 0;
>      rotated_index_str = g_match_info_fetch(matchInfo, 3);
>  
> -    if (!rotated_index_str)
> +    if (rotated_index_str)
>          return chain_prefix;
>  
>      if (virStrToLong_i(rotated_index_str, NULL, 10, rotated_index) < 0) {

I'm not sure this is the right fix. If rotated_index_str is NOT NULL
chain_prefix is returned. Fair enough. But when it is NULL then it's
passed to virStrToLong_i() which does not seem right.

Also, do you have a minimalist reproducer?

Michal



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux