diff options
author | Nirbhay Choubey <nirbhay.choubey@oracle.com> | 2011-04-27 17:27:51 +0530 |
---|---|---|
committer | Nirbhay Choubey <nirbhay.choubey@oracle.com> | 2011-04-27 17:27:51 +0530 |
commit | 6fcbb55fa20307c9e4c489acea6acd4d2c45936e (patch) | |
tree | f73c425b327ec1f353a5c60c8e7b87c35256ac4a /cmd-line-utils | |
parent | 767074e8b1726d02b71598691581db565b0b7678 (diff) | |
parent | c08c4e1fd765fff8ae76b2e61b0e04f550228660 (diff) | |
download | mariadb-git-6fcbb55fa20307c9e4c489acea6acd4d2c45936e.tar.gz |
Merge of fix for bug#12329909 from mysql-5.1 -> mysql-5.5.
Diffstat (limited to 'cmd-line-utils')
-rw-r--r-- | cmd-line-utils/libedit/vi.c | 12 |
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(): |