[PATCH master 3/3] pstore: return -ENOENT when file is missing
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon May 6 09:02:46 PDT 2024
The expectation with stat(2) and open(2) is that they report -ENOENT if
a file name doesn't exist. Return this instead of the unexpected -EINVAL
error code.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
fs/pstore/fs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/pstore/fs.c b/fs/pstore/fs.c
index 777e2448cc62..238a316e9157 100644
--- a/fs/pstore/fs.c
+++ b/fs/pstore/fs.c
@@ -148,7 +148,7 @@ static int pstore_open(struct device *dev, FILE *file, const char *filename)
d = pstore_get_by_name(head, filename);
if (!d)
- return -EINVAL;
+ return -ENOENT;
file->size = d->size;
file->priv = d;
@@ -226,7 +226,7 @@ static int pstore_stat(struct device *dev, const char *filename,
d = pstore_get_by_name(&allpstore, filename);
if (!d)
- return -EINVAL;
+ return -ENOENT;
s->st_size = d->size;
s->st_mode = S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO;
--
2.39.2
More information about the barebox
mailing list