diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2018-04-25 12:33:30 +0200 |
---|---|---|
committer | Dimitri Staessens <dimitri.staessens@ugent.be> | 2018-04-25 14:53:05 +0200 |
commit | 490ff55829df88fd57a1fa50f5e75b36faa4035a (patch) | |
tree | 35341f38791e7b4efed1715ad545ec547ad9030e | |
parent | c0de1f4f511106b4ed107778900835e1872a2b9b (diff) | |
download | ouroboros-490ff55829df88fd57a1fa50f5e75b36faa4035a.tar.gz ouroboros-490ff55829df88fd57a1fa50f5e75b36faa4035a.zip |
lib: Unlink old flow set shared memory
This unlinks previously allocated flow set shared memory. It could be
lingering in case an application with the same pid was SIGKILLED, and
didn't clean up its flow set shared memory.
Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
-rw-r--r-- | src/lib/shm_flow_set.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/shm_flow_set.c b/src/lib/shm_flow_set.c index 9d0e6c83..ca3a1a87 100644 --- a/src/lib/shm_flow_set.c +++ b/src/lib/shm_flow_set.c @@ -84,9 +84,13 @@ struct shm_flow_set * shm_flow_set_create() mode_t mask; int shm_fd; int i; + struct stat st; sprintf(fn, SHM_FLOW_SET_PREFIX "%d", getpid()); + if (stat(fn, &st) != -1 && unlink(fn)) + return NULL; + set = malloc(sizeof(*set)); if (set == NULL) return NULL; |