mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-07 21:03:10 +00:00
Use SPICE_FOREIGN_MENU_SOCKET if it's available
If specified, use SPICE_FOREIGN_MENU_SOCKET environment variable over snprintf(pipe_name, PIPE_NAME_MAX_LEN, PIPE_NAME, Platform::get_process_id()); since it's impossible to guess the client pid when spice-xpi launches the client as a grand-child (via script etc). This is also more aligned with the way we handle SPICE_XPI_SOCKET location.
This commit is contained in:
parent
01d565ff54
commit
1ab589f39e
@ -44,7 +44,7 @@ Controller::Controller(ControllerInterface *handler)
|
||||
#ifdef WIN32
|
||||
snprintf(pipe_name, PIPE_NAME_MAX_LEN, PIPE_NAME, Platform::get_process_id());
|
||||
#else
|
||||
char *p_socket = getenv("SPICE_XPI_SOCKET");
|
||||
const char *p_socket = getenv("SPICE_XPI_SOCKET");
|
||||
if (!p_socket) {
|
||||
LOG_ERROR("Failed to get a controller connection (SPICE_XPI_SOCKET)");
|
||||
throw Exception("Failed to get a controller connection (SPICE_XPI_SOCKET)");
|
||||
|
||||
@ -44,7 +44,13 @@ ForeignMenu::ForeignMenu(ForeignMenuInterface *handler, bool active)
|
||||
char pipe_name[PIPE_NAME_MAX_LEN];
|
||||
|
||||
ASSERT(_handler != NULL);
|
||||
snprintf(pipe_name, PIPE_NAME_MAX_LEN, PIPE_NAME, Platform::get_process_id());
|
||||
#ifndef WIN32
|
||||
const char *p_socket = getenv("SPICE_FOREIGN_MENU_SOCKET");
|
||||
if (p_socket)
|
||||
strncpy(pipe_name, p_socket, sizeof(pipe_name));
|
||||
else
|
||||
#endif
|
||||
snprintf(pipe_name, PIPE_NAME_MAX_LEN, PIPE_NAME, Platform::get_process_id());
|
||||
LOG_INFO("Creating a foreign menu connection %s", pipe_name);
|
||||
_foreign_menu = NamedPipe::create(pipe_name, *this);
|
||||
if (!_foreign_menu) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user