Set mode when creating shm object
$ wdisplays shm_open: Permission denied shm_open: Permission denied shm_open: Permission denied shm_open: Permission denied ^C $ posixshmcontrol ls MODE OWNER GROUP SIZE PATH --------- foo foo 33177600 /wd-DP-1
This commit is contained in:
parent
049bf5bd8f
commit
bfaf2211c0
@ -36,6 +36,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@ -190,7 +191,7 @@ static int create_shm_file(size_t size, const char *fmt, ...) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = shm_open(shm_name, O_CREAT | O_RDWR, 0);
|
fd = shm_open(shm_name, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
fprintf(stderr, "shm_open: %s\n", strerror(errno));
|
fprintf(stderr, "shm_open: %s\n", strerror(errno));
|
||||||
free(shm_name);
|
free(shm_name);
|
||||||
|
Loading…
Reference in New Issue
Block a user