summaryrefslogtreecommitdiff
path: root/src/apps
diff options
context:
space:
mode:
authorMilan Zamazal <mzamazal@redhat.com>2025-01-24 22:58:03 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2025-01-27 00:06:11 +0200
commit8aef7b4dfb12f2f9bf0513625231b85a5b8f5440 (patch)
tree8274b6376bcd1a0495290bc55a516e1c6e7b8a47 /src/apps
parent8072518ca9397e55c0356d712080c35b4947932d (diff)
apps: ppm_writer: Return EIO on I/O errorsHEADmaster
EINVAL should be returned only when the requested format is unsupported. On errors when writing the data, let's return EIO, which is the closest description of the situation when we don't inspect it more. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/apps')
-rw-r--r--src/apps/common/ppm_writer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/apps/common/ppm_writer.cpp b/src/apps/common/ppm_writer.cpp
index 2e9378aa..368de8bf 100644
--- a/src/apps/common/ppm_writer.cpp
+++ b/src/apps/common/ppm_writer.cpp
@@ -29,7 +29,7 @@ int PPMWriter::write(const char *filename,
std::ofstream output(filename, std::ios::binary);
if (!output) {
std::cerr << "Failed to open ppm file: " << filename << std::endl;
- return -EINVAL;
+ return -EIO;
}
output << "P6" << std::endl
@@ -37,7 +37,7 @@ int PPMWriter::write(const char *filename,
<< "255" << std::endl;
if (!output) {
std::cerr << "Failed to write the file header" << std::endl;
- return -EINVAL;
+ return -EIO;
}
const unsigned int rowLength = config.size.width * 3;
@@ -46,7 +46,7 @@ int PPMWriter::write(const char *filename,
output.write(row, rowLength);
if (!output) {
std::cerr << "Failed to write image data at row " << y << std::endl;
- return -EINVAL;
+ return -EIO;
}
}