From: Huzaifa Ali Zar Date: Tue, 28 Apr 2026 21:52:13 +0000 (+0000) Subject: [efi] Fix operator precedence in autoexec network download X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=df4eec8cfb4fda2b4bc1ce87fd101b80205c1e92;p=thirdparty%2Fipxe.git [efi] Fix operator precedence in autoexec network download The != operator has higher precedence than = in C, so the expressions: rc = imgacquire ( ..., image ) != 0 are parsed as: rc = ( imgacquire ( ..., image ) != 0 ) This assigns the boolean result (0 or 1) to rc instead of the actual return code from imgacquire(). As a result, strerror(rc) reports an incorrect error message when debugging is enabled. Add parentheses around each assignment to ensure rc captures the actual return value, matching the pattern already used in efi_autoexec_filesystem() within the same file. Modified-by: Michael Brown Signed-off-by: Michael Brown --- diff --git a/src/interface/efi/efi_autoexec.c b/src/interface/efi/efi_autoexec.c index 9125bfcf4..ab356a886 100644 --- a/src/interface/efi/efi_autoexec.c +++ b/src/interface/efi/efi_autoexec.c @@ -132,10 +132,10 @@ static int efi_autoexec_network ( EFI_HANDLE handle, struct image **image ) { } /* Attempt download from current working URI, then from root */ - if ( ( rc = imgacquire ( EFI_AUTOEXEC_NAME, EFI_AUTOEXEC_TIMEOUT, - image ) != 0 ) && - ( rc = imgacquire ( "/" EFI_AUTOEXEC_NAME, EFI_AUTOEXEC_TIMEOUT, - image ) != 0 ) ) { + if ( ( ( rc = imgacquire ( EFI_AUTOEXEC_NAME, EFI_AUTOEXEC_TIMEOUT, + image ) ) != 0 ) && + ( ( rc = imgacquire ( "/" EFI_AUTOEXEC_NAME, EFI_AUTOEXEC_TIMEOUT, + image ) ) != 0 ) ) { DBGC ( device, "EFI %s could not download [/]%s: %s\n", efi_handle_name ( device ), EFI_AUTOEXEC_NAME, strerror ( rc ) );