libedit/libedit-3.0-warnings.patch
Jerry James 52edeba194 * Mon Feb 7 2011 Jerry James <loganjerry@gmail.com> - 3.0-2.20100424cvs
- Update to 3.0 (20100424 snap)
- Enable wide-character (Unicode) support
2011-02-07 22:04:21 -07:00

94 lines
2.9 KiB
Diff

diff -durp libedit-20100424-3.0.orig/examples/fileman.c libedit-20100424-3.0/examples/fileman.c
--- libedit-20100424-3.0.orig/examples/fileman.c 2010-04-22 13:13:17.000000000 -0600
+++ libedit-20100424-3.0/examples/fileman.c 2011-02-07 13:14:13.209553427 -0700
@@ -279,7 +279,7 @@ command_generator (text, state)
/* Return the next name which partially matches from the
command list. */
- while (name = commands[list_index].name)
+ while ((name = commands[list_index].name))
{
list_index++;
diff -durp libedit-20100424-3.0.orig/examples/wtc1.c libedit-20100424-3.0/examples/wtc1.c
--- libedit-20100424-3.0.orig/examples/wtc1.c 2010-04-22 13:13:17.000000000 -0600
+++ libedit-20100424-3.0/examples/wtc1.c 2011-02-07 13:19:20.839378510 -0700
@@ -60,7 +60,7 @@ complete(EditLine *el, int ch)
char *buf, *bptr;
const LineInfoW *lf = el_wline(el);
int len, mblen, i;
- unsigned char res;
+ unsigned char res = CC_NORM;
/* Find the last word */
for (ptr = lf->cursor -1; !iswspace(*ptr) && ptr > lf->buffer; --ptr)
diff -durp libedit-20100424-3.0.orig/src/readline.c libedit-20100424-3.0/src/readline.c
--- libedit-20100424-3.0.orig/src/readline.c 2010-04-24 12:32:18.000000000 -0600
+++ libedit-20100424-3.0/src/readline.c 2011-02-07 13:14:13.210553427 -0700
@@ -1273,8 +1273,8 @@ history_truncate_file (const char *filen
}
}
fflush(fp);
- if((off = ftello(fp)) > 0)
- (void)ftruncate(fileno(fp), off);
+ if((off = ftello(fp)) > 0 && ftruncate(fileno(fp), off) < 0)
+ ret = errno;
out3:
fclose(tp);
out2:
diff -durp libedit-20100424-3.0.orig/src/vi.c libedit-20100424-3.0/src/vi.c
--- libedit-20100424-3.0.orig/src/vi.c 2010-04-22 14:09:52.000000000 -0600
+++ libedit-20100424-3.0/src/vi.c 2011-02-07 13:14:13.211553427 -0700
@@ -1008,6 +1008,7 @@ vi_histedit(EditLine *el, Int c)
char *cp;
size_t len;
Char *line;
+ el_action_t rv = CC_ERROR;
if (el->el_state.doingarg) {
if (vi_to_history_line(el, 0) == CC_ERROR)
@@ -1032,16 +1033,14 @@ vi_histedit(EditLine *el, Int c)
ct_wcstombs(cp, line, TMP_BUFSIZ - 1);
cp[TMP_BUFSIZ - 1] = '\0';
len = strlen(cp);
- write(fd, cp, len);
- write(fd, "\n", 1);
+ if (write(fd, cp, len) < 0 || write(fd, "\n", 1) < 0)
+ /* FIXME: handle EAGAIN somehow? */
+ goto fail;
+
pid = fork();
switch (pid) {
case -1:
- close(fd);
- unlink(tempfile);
- el_free(cp);
- el_free(line);
- return CC_ERROR;
+ goto fail;
case 0:
close(fd);
execlp("vi", "vi", tempfile, (char *)NULL);
@@ -1063,15 +1062,17 @@ vi_histedit(EditLine *el, Int c)
len = 0;
el->el_line.cursor = el->el_line.buffer;
el->el_line.lastchar = el->el_line.buffer + len;
- el_free(cp);
- el_free(line);
break;
}
+ /* return CC_REFRESH; */
+ rv = ed_newline(el, 0);
+fail:
close(fd);
unlink(tempfile);
- /* return CC_REFRESH; */
- return ed_newline(el, 0);
+ el_free(cp);
+ el_free(line);
+ return rv;
}
/* vi_history_word():