mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] edit: Return error when save_file failed
@ 2015-11-03 16:19 Enrico Jorns
  2015-11-04 11:03 ` [PATCH v2] " Enrico Jorns
  0 siblings, 1 reply; 6+ messages in thread
From: Enrico Jorns @ 2015-11-03 16:19 UTC (permalink / raw)
  To: barebox; +Cc: Enrico Jorns

When writing a file failed (e.g. due to a read-only file system), no
error was reported by the 'edit' tool. To be valid (and to not confuse
the poor user) at least '1' should be returned to indicate an error.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 commands/edit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commands/edit.c b/commands/edit.c
index b28e2b9..2d9c8b5 100644
--- a/commands/edit.c
+++ b/commands/edit.c
@@ -533,7 +533,8 @@ static int do_edit(int argc, char *argv[])
 			}
 			break;
 		case 4:
-			save_file(argv[1]);
+			if (save_file(argv[1]))
+				return 1;
 			goto out;
 		case 3:
 			goto out;
-- 
2.6.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-05  8:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-03 16:19 [PATCH] edit: Return error when save_file failed Enrico Jorns
2015-11-04 11:03 ` [PATCH v2] " Enrico Jorns
2015-11-04 12:23   ` Antony Pavlov
2015-11-04 13:30     ` Sascha Hauer
2015-11-04 14:48       ` Antony Pavlov
2015-11-05  8:17         ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox