summaryrefslogtreecommitdiffstats
path: root/commands/edit.c
diff options
context:
space:
mode:
authorSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-13 12:56:29 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-13 12:56:29 +0200
commit466078dbb2c35452f35288e0852590f510f3f967 (patch)
treeb57ddbac1404c26a5ad69734f71c26c9bfedc272 /commands/edit.c
parent75ded1c39479920ba2ada2f7544b1f8255381f19 (diff)
downloadbarebox-466078dbb2c35452f35288e0852590f510f3f967.tar.gz
barebox-466078dbb2c35452f35288e0852590f510f3f967.tar.xz
fix a bug in the editor when reading files which do not have
a \n at the last line
Diffstat (limited to 'commands/edit.c')
-rw-r--r--commands/edit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/commands/edit.c b/commands/edit.c
index efc74c752f..0c5325281a 100644
--- a/commands/edit.c
+++ b/commands/edit.c
@@ -205,7 +205,9 @@ static int edit_read_file(const char *path)
if (!lineend && !*linestr)
break;
- *lineend = 0;
+ if (lineend)
+ *lineend = 0;
+
line = line_realloc(strlen(linestr) + 1, NULL);
if (!buffer)
buffer = line;