mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch 9.2.0516: socketserver: spurious error when servername is taken
Problem: socketserver: when searching for a free socket path,
socketserver_get_path() emits an error for each name that is
already in use (after v9.2.0512).
Solution: Add an "ignore" argument to socketserver_get_path() to
suppress the error (Foxe Chen).
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
6574102fb4
commit
e3cb9655d7
+16
-8
@@ -63,7 +63,7 @@ static channel_T *client_channels = NULL;
|
||||
|
||||
static void socketserver_cleanup(void);
|
||||
static char_u *socketserver_create_path(char_u *name, bool quiet);
|
||||
static char_u *socketserver_get_path(char_u *name, bool new, bool quiet, bool *fatal);
|
||||
static char_u *socketserver_get_path(char_u *name, bool new, bool quiet, bool ignore, bool *fatal);
|
||||
static void socketserver_accept(channel_T *channel);
|
||||
static void socketserver_close(channel_T *channel);
|
||||
static ss_reply_T *socketserver_add_reply(char_u *sender);
|
||||
@@ -339,10 +339,10 @@ socketserver_create_path(char_u *name, bool quiet)
|
||||
if (buf != NULL)
|
||||
{
|
||||
vim_snprintf((char *)buf, buflen, "%s%d", name, i);
|
||||
path = socketserver_get_path(buf, true, quiet, &fatal);
|
||||
path = socketserver_get_path(buf, true, quiet, true, &fatal);
|
||||
}
|
||||
else
|
||||
path = socketserver_get_path(name, true, quiet, &fatal);
|
||||
path = socketserver_get_path(name, true, quiet, true, &fatal);
|
||||
|
||||
if (fatal)
|
||||
break;
|
||||
@@ -378,12 +378,20 @@ socketserver_create_path(char_u *name, bool quiet)
|
||||
* If "new" is true, then return a path if the name does not exist in the known
|
||||
* location.
|
||||
*
|
||||
* If "ignore" is true, then don't emit an error message if a suitable path
|
||||
* could not be found.
|
||||
*
|
||||
* If "fatal" is not NULL, then it is set to true if error is fatal.
|
||||
*
|
||||
* Returns path on success and NULL on failure.
|
||||
*/
|
||||
static char_u *
|
||||
socketserver_get_path(char_u *name, bool new UNUSED, bool quiet, bool *fatal)
|
||||
socketserver_get_path(
|
||||
char_u *name,
|
||||
bool new UNUSED,
|
||||
bool quiet,
|
||||
bool ignore UNUSED,
|
||||
bool *fatal)
|
||||
{
|
||||
# ifdef MSWIN
|
||||
// Only support channel addresses on Windows
|
||||
@@ -507,7 +515,7 @@ socketserver_get_path(char_u *name, bool new UNUSED, bool quiet, bool *fatal)
|
||||
{
|
||||
if (!res)
|
||||
semsg(_("Failed creating socket directory: %s"), strerror(errno));
|
||||
else
|
||||
else if (!ignore)
|
||||
semsg(_(e_invalid_server_id_used_str), name);
|
||||
}
|
||||
if (!res && fatal != NULL)
|
||||
@@ -1011,7 +1019,7 @@ socketserver_get_channel(char_u *name, bool quiet, bool *wait)
|
||||
}
|
||||
else
|
||||
{
|
||||
address = socketserver_get_path(name, false, quiet, NULL);
|
||||
address = socketserver_get_path(name, false, quiet, false, NULL);
|
||||
if (address == NULL)
|
||||
return NULL;
|
||||
is_unix = true;
|
||||
@@ -1324,7 +1332,7 @@ socketserver_read_reply(
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
actual = socketserver_get_path(client, false, false, NULL);
|
||||
actual = socketserver_get_path(client, false, false, false, NULL);
|
||||
if (actual == NULL)
|
||||
return FAIL;
|
||||
|
||||
@@ -1385,7 +1393,7 @@ socketserver_peek_reply(char_u *sender, char_u **str)
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
actual = socketserver_get_path(sender, false, false, NULL);
|
||||
actual = socketserver_get_path(sender, false, false, false, NULL);
|
||||
if (actual == NULL)
|
||||
return FAIL;
|
||||
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
516,
|
||||
/**/
|
||||
515,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user