mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
shmpipe: Don't pretend the path is random
This commit is contained in:
parent
7c2a445a72
commit
73fa2f9b76
1 changed files with 2 additions and 2 deletions
|
@ -225,6 +225,7 @@ sp_open_shm (char *path, int id, int writer, mode_t perms, size_t size)
|
||||||
char tmppath[PATH_MAX];
|
char tmppath[PATH_MAX];
|
||||||
int flags;
|
int flags;
|
||||||
int prot;
|
int prot;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
memset (area, 0, sizeof (ShmArea));
|
memset (area, 0, sizeof (ShmArea));
|
||||||
|
|
||||||
|
@ -244,8 +245,7 @@ sp_open_shm (char *path, int id, int writer, mode_t perms, size_t size)
|
||||||
area->shm_fd = shm_open (path, flags, perms);
|
area->shm_fd = shm_open (path, flags, perms);
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
snprintf (tmppath, PATH_MAX, "/%X%X%X%X%X.shmpipe",
|
snprintf (tmppath, PATH_MAX, "/shmpipe.5%d.%5d", getpid (), i++);
|
||||||
rand (), rand (), rand (), rand (), rand ());
|
|
||||||
area->shm_fd = shm_open (tmppath, flags, perms);
|
area->shm_fd = shm_open (tmppath, flags, perms);
|
||||||
} while (area->shm_fd < 0 && errno == EEXIST);
|
} while (area->shm_fd < 0 && errno == EEXIST);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue