summaryrefslogtreecommitdiff
path: root/cmd-line-utils
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay.choubey@oracle.com>2011-04-27 17:24:10 +0530
committerNirbhay Choubey <nirbhay.choubey@oracle.com>2011-04-27 17:24:10 +0530
commita1f7ceb281f9d87c9baea125ebab26f99a0370f8 (patch)
treee9e2cc42651948d3b6b1150888598a14bbbcfd49 /cmd-line-utils
parenta60c39a2ffc7ec0c0b4ae8bbadf733773ec7557f (diff)
downloadmariadb-git-a1f7ceb281f9d87c9baea125ebab26f99a0370f8.tar.gz
BUG#12329909 - BUILDING MYSQL WITH DEBUG SUPPORT
FAILS WITH LIBEDIT Fixed by checking the return value of the write() function calls and handling the open files and fd appropriately. cmd-line-utils/libedit/vi.c: BUG#12329909 - BUILDING MYSQL WITH DEBUG SUPPORT FAILS WITH LIBEDIT Added a check on the return value of the write() function calls.
Diffstat (limited to 'cmd-line-utils')
-rw-r--r--cmd-line-utils/libedit/vi.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd-line-utils/libedit/vi.c b/cmd-line-utils/libedit/vi.c
index d628f076a1d..beffc7b40b5 100644
--- a/cmd-line-utils/libedit/vi.c
+++ b/cmd-line-utils/libedit/vi.c
@@ -1012,8 +1012,10 @@ vi_histedit(EditLine *el, int c __attribute__((__unused__)))
if (fd < 0)
return CC_ERROR;
cp = el->el_line.buffer;
- write(fd, cp, el->el_line.lastchar - cp +0u);
- write(fd, "\n", 1);
+ if (write(fd, cp, el->el_line.lastchar - cp +0u) == -1)
+ goto error;
+ if (write(fd, "\n", 1) == -1)
+ goto error;
pid = fork();
switch (pid) {
case -1:
@@ -1041,6 +1043,12 @@ vi_histedit(EditLine *el, int c __attribute__((__unused__)))
unlink(tempfile);
/* return CC_REFRESH; */
return ed_newline(el, 0);
+
+/* XXXMYSQL: Avoid compiler warnings. */
+error:
+ close(fd);
+ unlink(tempfile);
+ return CC_ERROR;
}
/* vi_history_word():