diff --git a/fdtextract.c b/fdtextract.c
index 91040aa73a1da48622dd8d7fb8a6fac84a847192..7188b6ebc0a9b1445624b6e4fe248a1ca40087f0 100644
--- a/fdtextract.c
+++ b/fdtextract.c
@@ -99,7 +99,7 @@ static int extract_image(char *buf, char *name, char *out)
snprintf(path, MAX_PATH_LEN, "/images/%s", name);
noffset = fdt_path_offset(buf, path);
if (noffset < 0) {
- printf("Error: could not find image: %s.\n", name);
+ fprintf(stderr, "Error: could not find image: %s.\n", name);
return -1;
}
@@ -113,7 +113,7 @@ static int extract_image(char *buf, char *name, char *out)
/* Absolute offset */
val = fdt_getprop(buf, noffset, "data-position", NULL);
if (!val) {
- printf("Error: could get offset of image: %s.\n", name);
+ fprintf(stderr, "Error: could get offset of image: %s.\n", name);
return -1;
}
data_offset = fdt32_to_cpu(*val);
@@ -122,7 +122,7 @@ static int extract_image(char *buf, char *name, char *out)
/* Size */
val = fdt_getprop(buf, noffset, "data-size", NULL);
if (!val) {
- printf("Error: could get size of image: %s.\n", name);
+ fprintf(stderr, "Error: could get size of image: %s.\n", name);
return -1;
}
@@ -133,7 +133,7 @@ static int extract_image(char *buf, char *name, char *out)
if (out) {
fd = open(out, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd < 0) {
- printf("Error opening output file %s.\n", out);
+ fprintf(stderr, "Error opening output file %s.\n", out);
return errno;
}
} else {
@@ -142,7 +142,7 @@ static int extract_image(char *buf, char *name, char *out)
count = write(fd, buf + data_offset, data_size);
if (count < data_size) {
- printf("Error writing output file %s.\n", out);
+ fprintf(stderr, "Error writing output file %s.\n", out);
return errno;
}
@@ -161,14 +161,14 @@ static int get_hash(char *buf, char *name)
snprintf(path, MAX_PATH_LEN, "/images/%s/hash-1", name);
noffset = fdt_path_offset(buf, path);
if (noffset < 0) {
- printf("Error: could not find image hash: %s.\n", name);
+ fprintf(stderr, "Error: could not find image hash: %s.\n", name);
return -1;
}
/* Verify that we know the hash algo. */
algo = fdt_getprop(buf, noffset, "algo", NULL);
if (strcmp(algo, "sha256")) {
- printf("Error: unknown hash algorithm %s\n", val);
+ fprintf(stderr, "Error: unknown hash algorithm %s\n", val);
return -1;
}
@@ -190,14 +190,14 @@ static int get_attribute(char *buf, char *name)
/* Get path of root node. */
noffset = fdt_path_offset(buf, "/");
if (noffset < 0) {
- printf("Error: could not find image hash: %s.\n", name);
+ fprintf(stderr, "Error: could not find image hash: %s.\n", name);
return -1;
}
/* Print the property value. */
val = fdt_getprop(buf, noffset, name, NULL);
if (!val) {
- printf("Error: could not find property %s.\n", name);
+ fprintf(stderr, "Error: could not find property %s.\n", name);
return -1;
}
printf("%s\n", val);