From: Chet Ramey Date: Tue, 10 Nov 2015 21:23:48 +0000 (-0500) Subject: commit readline-20151030 snapshot X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eea9c4d8b8d83f480152853e758f8eaf072cf408;p=thirdparty%2Freadline.git commit readline-20151030 snapshot --- diff --git a/display.c b/display.c index 4353d6e..bce4897 100644 --- a/display.c +++ b/display.c @@ -580,13 +580,13 @@ rl_redisplay () int inv_botlin, lb_botlin, lb_linenum, o_cpos; int newlines, lpos, temp, n0, num, prompt_lines_estimate; char *prompt_this_line; + int mb_cur_max = MB_CUR_MAX; #if defined (HANDLE_MULTIBYTE) wchar_t wc; size_t wc_bytes; int wc_width; mbstate_t ps; int _rl_wrapped_multicolumn = 0; - int mb_cur_max = MB_CUR_MAX; #endif if (_rl_echoing_p == 0) @@ -1029,9 +1029,11 @@ rl_redisplay () not the first. */ if (out >= _rl_screenchars) { +#if defined (HANDLE_MULTIBYTE) if (mb_cur_max > 1 && rl_byte_oriented == 0) out = _rl_find_prev_mbchar (line, _rl_screenchars, MB_FIND_ANY); else +#endif out = _rl_screenchars - 1; } diff --git a/histfile.c b/histfile.c index 8749886..860653f 100644 --- a/histfile.c +++ b/histfile.c @@ -613,10 +613,11 @@ history_do_write (filename, nelements, overwrite) mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY; #endif histname = history_filename (filename); - tempname = (overwrite && histname) ? history_tempfile (histname) : 0; - output = tempname ? tempname : histname; exists = histname ? (stat (histname, &finfo) == 0) : 0; + tempname = (overwrite && exists && S_ISREG (finfo.st_mode)) ? history_tempfile (histname) : 0; + output = tempname ? tempname : histname; + file = output ? open (output, mode, 0600) : -1; rv = 0;