Skip to content

Commit df4eec8

Browse files
Huzaifa Ali Zarmcb30
authored andcommitted
[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 <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
1 parent 8d2ebbf commit df4eec8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/interface/efi/efi_autoexec.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ static int efi_autoexec_network ( EFI_HANDLE handle, struct image **image ) {
132132
}
133133

134134
/* Attempt download from current working URI, then from root */
135-
if ( ( rc = imgacquire ( EFI_AUTOEXEC_NAME, EFI_AUTOEXEC_TIMEOUT,
136-
image ) != 0 ) &&
137-
( rc = imgacquire ( "/" EFI_AUTOEXEC_NAME, EFI_AUTOEXEC_TIMEOUT,
138-
image ) != 0 ) ) {
135+
if ( ( ( rc = imgacquire ( EFI_AUTOEXEC_NAME, EFI_AUTOEXEC_TIMEOUT,
136+
image ) ) != 0 ) &&
137+
( ( rc = imgacquire ( "/" EFI_AUTOEXEC_NAME, EFI_AUTOEXEC_TIMEOUT,
138+
image ) ) != 0 ) ) {
139139
DBGC ( device, "EFI %s could not download [/]%s: %s\n",
140140
efi_handle_name ( device ), EFI_AUTOEXEC_NAME,
141141
strerror ( rc ) );

0 commit comments

Comments
 (0)