myadm

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

commit 79f02bed6cd9ff5947ed71294abf2a5472fbc124
parent d135c391f6afac314b22e6a8837d91349925a51c
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Wed, 27 Apr 2016 23:30:24 +0200

Handle write() error in fput().

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

diff --git a/myadm.c b/myadm.c @@ -406,7 +406,10 @@ fput(char *fn, char *s, int size) { fd = open(fn, O_WRONLY | O_TRUNC); if(fd == -1) return -1; - write(fd, s, size); + if(write(fd, s, size) == -1) { + close(fd); + return -1; + } close(fd); return 0; }