Mercurial > dwindows
changeset 1962:50c71474709b
Added PID to the unix domain socket name, to avoid conflicts from multiple
instances of the same application. Also unlink (delete) any left over
filesystem nodes from previous runs of the application.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 26 Jul 2019 21:54:14 +0000 |
parents | 824fdbc2f761 |
children | 80f6be39b7fe |
files | dwcompat.h |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/dwcompat.h Fri Jul 26 07:08:53 2019 +0000 +++ b/dwcompat.h Fri Jul 26 21:54:14 2019 +0000 @@ -195,7 +195,7 @@ #define PIPEROOT "/tmp/" #endif -#define PIPENAME "%s" __TARGET__ "%d" +#define PIPENAME "%s" __TARGET__ "%d-%d" #if defined(_P_NOWAIT) && !defined(P_NOWAIT) #define P_NOWAIT _P_NOWAIT @@ -342,7 +342,8 @@ pipes[1] = socket(AF_UNIX, SOCK_STREAM, 0); \ memset(&un, 0, sizeof(un)); \ un.sun_family=AF_UNIX; \ - sprintf(un.sun_path, PIPENAME, PIPEROOT, pipes[1]); \ + sprintf(un.sun_path, PIPENAME, PIPEROOT, (int)getpid(), pipes[1]); \ + unlink(un.sun_path); \ bind(tmpsock, (struct sockaddr *)&un, sizeof(un)); \ listen(tmpsock, 0); \ connect(pipes[1], (struct sockaddr *)&un, sizeof(un)); \