Skip to content

Commit

Permalink
Revert "Bug 16: SHM connection can fail if it is already created, try…
Browse files Browse the repository at this point in the history
… to connect with various permissions"

This reverts commit a8a7dbf.
  • Loading branch information
dimitry-ishenko committed Dec 19, 2020
1 parent 780eca1 commit cf2ad4f
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions jltcntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include <sys/shm.h>
#include <sys/time.h>
#include <time.h>
#include <errno.h>

static int keep_running = 1;

Expand Down Expand Up @@ -442,17 +441,7 @@ int main(int argc, char **argv)

if (unit >= 0)
{
int shmid = -1;
int errshm = EACCES;
const int perms[] = {0777, 0666, 0770, 0660, 0700, 0600};
int attempt = 0;

while (shmid == -1 && errshm == EACCES && attempt < sizeof(perms)) {
shmid = shmget(0x4e545030 + unit, sizeof (struct shmTime), IPC_CREAT | perms[attempt]);
errshm = errno;
attempt++;
}

int shmid = shmget(0x4e545030 + unit, sizeof (struct shmTime), IPC_CREAT | 0777);
if (shmid != -1)
{
shm = (struct shmTime *) shmat(shmid, NULL, 0);
Expand Down

0 comments on commit cf2ad4f

Please sign in to comment.