The return value of this function isn't checked. A small change, the
next step is to skip lines that are too long.
ok?
Index: history.c
===================================================================
RCS file: /d/cvs/src/bin/ksh/history.c,v
retrieving revision 1.71
diff -u -p -p -u -r1.71 history.c
--- history.c 7 Sep 2017 19:08:32 -0000 1.71
+++ history.c 15 Oct 2017 21:53:15 -0000
@@ -29,7 +29,7 @@
static void history_write(void);
static FILE *history_open(void);
-static int history_load(Source *);
+static void history_load(Source *);
static void history_close(void);
static int hist_execute(char *);
@@ -736,7 +736,7 @@ history_close(void)
}
}
-static int
+static void
history_load(Source *s)
{
char *p, encoded[LINE + 1], line[LINE + 1];
@@ -750,7 +750,7 @@ history_load(Source *s)
break;
if ((p = strchr(encoded, '\n')) == NULL) {
bi_errorf("history file is corrupt");
- return 1;
+ return;
}
*p = '\0';
s->line = line_co;
@@ -760,8 +760,6 @@ history_load(Source *s)
}
history_write();
-
- return 0;
}
#define HMAGIC1 0xab
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE