From 5161f447f6dfb13082c6cdebb1b5806e0e3d6a16 Mon Sep 17 00:00:00 2001 From: Rui Abreu Ferreira Date: Wed, 30 Sep 2015 16:13:12 +0100 Subject: Implement server_address_new() When creating a local socket/pipe (server_start()) Neovim used vim_tempname() to generate a unique socket path. For Windows UNIX filepaths cannot be used as pipe names (they must start with \\.\pipe\). This commit replaces the use of vim_tempname() for server addresses with server_address_new(). server_address_new() generates unique names for local sockets/pipes - for UNIX it uses vim_tempname(), for Windows generates names in the form \\.\pipe\nvim-PID-COUNTER where PID is the current process id, and COUNTER is a static uint32_t counter incremented with every call. This function is now used for server_start() and server_init() when no address is available. --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d02348028a..a1ac713a75 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -14572,7 +14572,7 @@ static void f_serverstart(typval_T *argvars, typval_T *rettv) rettv->vval.v_string = vim_strsave(get_tv_string(argvars)); } } else { - rettv->vval.v_string = vim_tempname(); + rettv->vval.v_string = (char_u *)server_address_new(); } int result = server_start((char *) rettv->vval.v_string); -- cgit