X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fkeybindings.c;h=121304bdadd9ed2d773adf6eed374f4c8a034bd4;hb=b97faa0009abc699ab7bff7bcc3221b8b3104e12;hp=c318ec18f49c1501c0e72640d7e01db01303350a;hpb=e55ff0044903e9af87e24d01a809ce0a0c562633;p=plomrogue
diff --git a/src/keybindings.c b/src/keybindings.c
index c318ec1..121304b 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -18,12 +18,13 @@ extern void init_keybindings(struct World * world)
{
FILE * file = fopen("config/keybindings", "r");
uint16_t lines, linemax;
- textfile_sizes(file, &linemax, &lines);
+ char * err = "textfile_sizes() in init_keybindings() returns error.";
+ exit_err(textfile_sizes(file, &linemax, &lines), world, err);
struct KeyBinding * keybindings = malloc(lines * sizeof(struct KeyBinding));
char * command = malloc(linemax);
uint16_t commcount = 0;
char * cmdptr;
- while (fgets(command, linemax, file))
+ while (fgets(command, linemax + 1, file))
{
keybindings[commcount].key = atoi(command);
cmdptr = strchr(command, ' ') + 1;