efibootmgr: fix an incorrect error handling check

efivar_device_path_to_unix_path() returns standard error codes on
failure and zero on success. Checking for a return value less than zero
means that the actual failure cases won't be handled. This could
manifest as a segfault during the subsequent call to printf().

Reviewed by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D27424
This commit is contained in:
Mitchell Horne 2020-11-30 22:16:11 +00:00
parent 8db8bebf1f
commit 2e085395e1
1 changed files with 1 additions and 1 deletions

View File

@ -1034,7 +1034,7 @@ report_esp_device(bool do_dp, bool do_unix)
printf("%s\n", buf); printf("%s\n", buf);
exit(0); exit(0);
} }
if (efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath) < 0) if (efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath) != 0)
errx(1, "Can't convert to unix path"); errx(1, "Can't convert to unix path");
if (do_unix) { if (do_unix) {
if (abspath == NULL) if (abspath == NULL)