[igt-dev] [i-g-t,2/7] runner: make the usage function variadic
Maíra Canal
maira.canal at usp.br
Tue Jun 28 23:51:43 UTC 2022
On 6/28/22 11:44, Ryszard Knop wrote:
> For easier error logging, make the usage() function variadic and pass
> its arguments to vfprintf. Additionally, reorder its arguments so that
> it visually matches all the printf functions.
>
> Signed-off-by: Ryszard Knop <ryszard.knop at intel.com>
> ---
Hi,
Overall this looks good, just a small typo.
> @@ -806,24 +808,19 @@ bool serialize_settings(struct settings *settings)
>
> if (!settings->overwrite &&
> faccessat(dirfd, settings_filename, F_OK, 0) == 0) {
> - usage("Settings metadata already exists and not overwriting", stderr);
> + usage(stderr, "Settings metadata already exists and not overwriting");
> return false;
> }
>
> if (settings->overwrite &&
> unlinkat(dirfd, settings_filename, 0) != 0 &&
> errno != ENOENT) {
> - usage("Error removing old settings metadata", stderr);
> + usage(stderr, "Error removing old settings metadata");
> return false;
> }
>
> if ((fd = openat(dirfd, settings_filename, O_CREAT | O_EXCL | O_WRONLY, 0666)) < 0) {
> - char *msg;
> -
> - asprintf(&msg, "Creating settings serialization file failed: %s", strerror(errno));
> - usage(msg, stderr);
> -
> - free(msg);
> + usage(msg, "Creating settings serialization file failed: %s", strerror(errno));
I believe this should be:
usage(stderr, "Creating settings serialization file failed: %s", strerror(errno));
Reviewed-by: Maíra Canal <maira.canal at usp.br>
Best Regards,
- Maíra Canal
> close(dirfd);
> return false;
> }
More information about the igt-dev
mailing list