mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
contrib/elf2dmp: Assume error by default
A common construct in contrib/elf2dmp is to set "err" flag and goto in error paths. In such a construct, there is only one successful path while there are several error paths, so it will be more simpler to initialize "err" flag set, and clear it in the successful path. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu> Message-id: 20240307-elf2dmp-v4-2-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
b48139d0d9
commit
a4e58de146
2 changed files with 4 additions and 15 deletions
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
int download_url(const char *name, const char *url)
|
||||
{
|
||||
int err = 0;
|
||||
int err = 1;
|
||||
FILE *file;
|
||||
CURL *curl = curl_easy_init();
|
||||
|
||||
|
|
@ -21,7 +21,6 @@ int download_url(const char *name, const char *url)
|
|||
|
||||
file = fopen(name, "wb");
|
||||
if (!file) {
|
||||
err = 1;
|
||||
goto out_curl;
|
||||
}
|
||||
|
||||
|
|
@ -33,7 +32,6 @@ int download_url(const char *name, const char *url)
|
|||
|| curl_easy_perform(curl) != CURLE_OK) {
|
||||
unlink(name);
|
||||
fclose(file);
|
||||
err = 1;
|
||||
} else {
|
||||
err = fclose(file);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue