The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipc: Unlink on exit, not before start.

+12 -1
+3
src/xrt/ipc/ipc_server.h
··· 159 159 //! Were we launched by socket activation, instead of explicitly? 160 160 bool launched_by_socket; 161 161 162 + //! The socket filename we bound to, if any. 163 + char *socket_filename; 164 + 162 165 bool print_debug; 163 166 bool print_spew; 164 167
+9 -1
src/xrt/ipc/ipc_server_process.c
··· 36 36 #include <fcntl.h> 37 37 #include <errno.h> 38 38 #include <stdio.h> 39 + #include <string.h> 39 40 40 41 #ifdef XRT_HAVE_SYSTEMD 41 42 #include <systemd/sd-daemon.h> ··· 75 76 // Close socket on exit 76 77 close(s->listen_socket); 77 78 s->listen_socket = -1; 79 + if (!s->launched_by_socket && s->socket_filename) { 80 + // Unlink it too, but only if we bound it. 81 + unlink(s->socket_filename); 82 + free(s->socket_filename); 83 + s->socket_filename = NULL; 84 + } 78 85 } 79 86 } 80 87 ··· 214 221 215 222 addr.sun_family = AF_UNIX; 216 223 strcpy(addr.sun_path, IPC_MSG_SOCK_FILE); 217 - unlink(IPC_MSG_SOCK_FILE); 218 224 219 225 ret = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); 220 226 if (ret < 0) { 221 227 close(fd); 222 228 return ret; 223 229 } 230 + // Save for later 231 + s->socket_filename = strdup(IPC_MSG_SOCK_FILE); 224 232 225 233 ret = listen(fd, IPC_MAX_CLIENTS); 226 234 if (ret < 0) {