3674 Nirbhay Choubey 2011-04-27
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.
modified:
cmd-line-utils/libedit/vi.c
3673 Sergey Glukhov 2011-04-27
Bug#11889186 60503: CRASH IN MAKE_DATE_TIME WITH DATE_FORMAT / STR_TO_DATE COMBINATION
calc_daynr() function returns negative result
if malformed date with zero year and month is used.
Attempt to calculate week day on negative value
leads to crash. The fix is return NULL for
'W', 'a', 'w' specifiers if zero year and month is used.
Additional fix for calc_daynr():
--added assertion that result can not be negative
--return 0 if zero year and month is used
@ mysql-test/r/func_time.result
test case
@ mysql-test/t/func_time.test
test case
@ sql-common/my_time.c
--added assertion that result can not be negative
--return 0 if zero year and month is used
@ sql/item_timefunc.cc
eturn NULL for 'W', 'a', 'w' specifiers
if zero year and month is used.
modified:
mysql-test/r/func_time.result
mysql-test/t/func_time.test
sql-common/my_time.c
sql/item_timefunc.cc
=== modified file 'cmd-line-utils/libedit/vi.c'
--- a/cmd-line-utils/libedit/vi.c 2010-10-19 22:36:59 +0000
+++ b/cmd-line-utils/libedit/vi.c 2011-04-27 11:54:10 +0000
@@ -1012,8 +1012,10 @@ vi_histedit(EditLine *el, int c __attrib
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 __attrib
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():
Attachment: [text/bzr-bundle] bzr/nirbhay.choubey@oracle.com-20110427115410-vpeshiv6u5snkvzi.bundle
| Thread |
|---|
| • bzr push into mysql-5.1 branch (nirbhay.choubey:3673 to 3674) Bug#12329909 | Nirbhay Choubey | 27 Apr |