summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2022-01-18 07:39:44 +0300
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-01-29 12:23:40 +0300
commitdf1ce60facb2881aff6ea139f479457e163aaf45 (patch)
tree7a7a3342e1fe098d983df4d28457c836dd076cdf /tools
parent3dd719d4fb2ee10bbc00729f4bcd0fba47a8360d (diff)
downloadu-boot-df1ce60facb2881aff6ea139f479457e163aaf45.tar.xz
tools: mkeficapsule: output messages to stderr instead of stdout
All the error messages should be printed out to stderr. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/mkeficapsule.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c
index 4995ba4e0c..b22b61a9a5 100644
--- a/tools/mkeficapsule.c
+++ b/tools/mkeficapsule.c
@@ -81,21 +81,22 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
g = fopen(bin, "r");
if (!g) {
- printf("cannot open %s\n", bin);
+ fprintf(stderr, "cannot open %s\n", bin);
return -1;
}
if (stat(bin, &bin_stat) < 0) {
- printf("cannot determine the size of %s\n", bin);
+ fprintf(stderr, "cannot determine the size of %s\n", bin);
goto err_1;
}
data = malloc(bin_stat.st_size);
if (!data) {
- printf("cannot allocate memory: %zx\n", (size_t)bin_stat.st_size);
+ fprintf(stderr, "cannot allocate memory: %zx\n",
+ (size_t)bin_stat.st_size);
goto err_1;
}
f = fopen(path, "w");
if (!f) {
- printf("cannot open %s\n", path);
+ fprintf(stderr, "cannot open %s\n", path);
goto err_2;
}
header.capsule_guid = efi_guid_fm_capsule;
@@ -109,7 +110,7 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
size = fwrite(&header, 1, sizeof(header), f);
if (size < sizeof(header)) {
- printf("write failed (%zx)\n", size);
+ fprintf(stderr, "write failed (%zx)\n", size);
goto err_3;
}
@@ -118,13 +119,13 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
capsule.payload_item_count = 1;
size = fwrite(&capsule, 1, sizeof(capsule), f);
if (size < (sizeof(capsule))) {
- printf("write failed (%zx)\n", size);
+ fprintf(stderr, "write failed (%zx)\n", size);
goto err_3;
}
offset = sizeof(capsule) + sizeof(u64);
size = fwrite(&offset, 1, sizeof(offset), f);
if (size < sizeof(offset)) {
- printf("write failed (%zx)\n", size);
+ fprintf(stderr, "write failed (%zx)\n", size);
goto err_3;
}
@@ -141,17 +142,17 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
size = fwrite(&image, 1, sizeof(image), f);
if (size < sizeof(image)) {
- printf("write failed (%zx)\n", size);
+ fprintf(stderr, "write failed (%zx)\n", size);
goto err_3;
}
size = fread(data, 1, bin_stat.st_size, g);
if (size < bin_stat.st_size) {
- printf("read failed (%zx)\n", size);
+ fprintf(stderr, "read failed (%zx)\n", size);
goto err_3;
}
size = fwrite(data, 1, bin_stat.st_size, f);
if (size < bin_stat.st_size) {
- printf("write failed (%zx)\n", size);
+ fprintf(stderr, "write failed (%zx)\n", size);
goto err_3;
}
@@ -194,7 +195,7 @@ int main(int argc, char **argv)
switch (c) {
case 'f':
if (file) {
- printf("Image already specified\n");
+ fprintf(stderr, "Image already specified\n");
return -1;
}
file = optarg;
@@ -202,7 +203,7 @@ int main(int argc, char **argv)
break;
case 'r':
if (file) {
- printf("Image already specified\n");
+ fprintf(stderr, "Image already specified\n");
return -1;
}
file = optarg;
@@ -234,7 +235,7 @@ int main(int argc, char **argv)
if (create_fwbin(argv[optind], file, guid, index, instance)
< 0) {
- printf("Creating firmware capsule failed\n");
+ fprintf(stderr, "Creating firmware capsule failed\n");
exit(EXIT_FAILURE);
}