mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 7.4.1329
Problem: Crash when using channel that failed to open. Solution: Check for NULL. Update messages. (Yukihiro Nakadaira)
This commit is contained in:
@@ -634,7 +634,7 @@ channel_open(char *hostname, int port_in, int waittime, void (*close_cb)(void))
|
|||||||
{
|
{
|
||||||
/* Get here when the server can't be found. */
|
/* Get here when the server can't be found. */
|
||||||
ch_error(NULL, "Cannot connect to port after retry\n");
|
ch_error(NULL, "Cannot connect to port after retry\n");
|
||||||
PERROR(_("E899: Cannot connect to port after retry2"));
|
PERROR(_("E899: Cannot connect to port after retry"));
|
||||||
sock_close(sd);
|
sock_close(sd);
|
||||||
channel_free(channel);
|
channel_free(channel);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1220,7 +1220,7 @@ channel_status(channel_T *channel)
|
|||||||
void
|
void
|
||||||
channel_close(channel_T *channel)
|
channel_close(channel_T *channel)
|
||||||
{
|
{
|
||||||
ch_log(channel, "Closing channel");
|
ch_log(channel, "Closing channel\n");
|
||||||
|
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
channel_gui_unregister(channel);
|
channel_gui_unregister(channel);
|
||||||
|
@@ -21828,7 +21828,10 @@ get_tv_string_buf_chk(typval_T *varp, char_u *buf)
|
|||||||
channel_T *channel = varp->vval.v_channel;
|
channel_T *channel = varp->vval.v_channel;
|
||||||
char *status = channel_status(channel);
|
char *status = channel_status(channel);
|
||||||
|
|
||||||
vim_snprintf((char *)buf, NUMBUFLEN,
|
if (channel == NULL)
|
||||||
|
vim_snprintf((char *)buf, NUMBUFLEN, "channel %s", status);
|
||||||
|
else
|
||||||
|
vim_snprintf((char *)buf, NUMBUFLEN,
|
||||||
"channel %d %s", channel->ch_id, status);
|
"channel %d %s", channel->ch_id, status);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@@ -22467,7 +22470,8 @@ copy_tv(typval_T *from, typval_T *to)
|
|||||||
case VAR_CHANNEL:
|
case VAR_CHANNEL:
|
||||||
#ifdef FEAT_CHANNEL
|
#ifdef FEAT_CHANNEL
|
||||||
to->vval.v_channel = from->vval.v_channel;
|
to->vval.v_channel = from->vval.v_channel;
|
||||||
++to->vval.v_channel->ch_refcount;
|
if (to->vval.v_channel != NULL)
|
||||||
|
++to->vval.v_channel->ch_refcount;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case VAR_STRING:
|
case VAR_STRING:
|
||||||
|
@@ -318,3 +318,9 @@ endfunc
|
|||||||
func Test_unlet_handle()
|
func Test_unlet_handle()
|
||||||
call s:run_server('s:unlet_handle')
|
call s:run_server('s:unlet_handle')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_open_fail()
|
||||||
|
silent! let ch = ch_open("noserver")
|
||||||
|
echo ch
|
||||||
|
let d = ch
|
||||||
|
endfunc
|
||||||
|
@@ -747,6 +747,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1329,
|
||||||
/**/
|
/**/
|
||||||
1328,
|
1328,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user