[LTP] [PATCH 04/19] Unify error handling in lib/safe_file_ops.c

Cyril Hrubis chrubis@suse.cz
Thu Oct 29 16:59:07 CET 2020


Hi!
> diff --git a/lib/safe_file_ops.c b/lib/safe_file_ops.c
> index e06d399fa..a63368875 100644
> --- a/lib/safe_file_ops.c
> +++ b/lib/safe_file_ops.c
> @@ -84,9 +84,8 @@ int file_scanf(const char *file, const int lineno,
>  	f = fopen(path, "r");
>  
>  	if (f == NULL) {
> -		tst_resm(TWARN,
> -			"Failed to open FILE '%s' at %s:%d",
> -			 path, file, lineno);
> +		tst_resm_(file, lineno, TWARN, "Failed to open FILE '%s'",
> +			path);
>  		return 1;

scanf() returns negative value on error, I guess it would make more
sense to return -1 here and in many cases below.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list