commit 497b5ec48c4f5af85b50bafb96ac6e95db967e60
parent 7487d4b7a2f90a233f76c19792ce61fbf48663ad
Author: Claudio Alessi <smoppy@gmail.com>
Date: Mon, 25 Apr 2016 15:52:32 +0200
Unlink tmp file if cannot fput().
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/myadm.c b/myadm.c
@@ -298,8 +298,10 @@ editbuf(char *in, int len, int *sz) {
close(fd);
a.v = (const char*[]){"/bin/sh", "-c", "$EDITOR \"$0\"", tmp, NULL};
- if(fput(tmp, in, len) == -1)
+ if(fput(tmp, in, len) == -1) {
+ unlink(tmp);
return NULL;
+ }
spawn(&a);
wait(NULL);
curs_set(1); curs_set(0); /* XXX Investigate... */