List:Commits« Previous MessageNext Message »
From:Nirbhay Choubey Date:April 27 2011 11:54am
Subject:bzr commit into mysql-5.1 branch (nirbhay.choubey:3674) Bug#12329909
View as plain text  
#At file:///home/nirbhay/Project/mysql/repo/bugs/mysql-5.1.12329909/ based on revid:sergey.glukhov@stripped

 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
=== 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 commit into mysql-5.1 branch (nirbhay.choubey:3674) Bug#12329909Nirbhay Choubey27 Apr