myadm

Simple MySQL client for the terminal
git clone git://git.bitsmanent.org/myadm
Log | Files | Refs | README | LICENSE

commit 7487d4b7a2f90a233f76c19792ce61fbf48663ad
parent d308784a6ac925cbfbdd43c88edc7334344e333a
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Mon, 25 Apr 2016 15:46:31 +0200

Add the null byte in fget()

Diffstat:
Mmyadm.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/myadm.c b/myadm.c @@ -375,8 +375,9 @@ fget(char *fn, int *sz) { return NULL; *sz = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); - buf = ecalloc(1, *sz); + buf = ecalloc(1, *sz+1); read(fd, buf, *sz); + buf[*sz] = '\0'; close(fd); return buf; }