Skip to content

Commit

Permalink
Remove atoi
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaivel committed Aug 14, 2023
1 parent 9a2fe69 commit 52fa2b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ int main(int argc, char **argv)
shm_unlink(SGL_SHARED_MEMORY_NAME);
return 0;
case 'g':
major = atoi(argv[i + 1]);
minor = atoi(&argv[i + 1][2]);
major = argv[i + 1][0] - '0';
minor = argv[i + 1][2] - '0';
i++;
break;
case 'r': {
Expand Down Expand Up @@ -125,7 +125,7 @@ int main(int argc, char **argv)

if (ftruncate(shm_fd, shm_size) == -1) {
fprintf(stderr, "[-] failed to truncate shared memory\n");
return -1;
return -2;
}

shm_ptr = mmap(0, shm_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);
Expand Down

0 comments on commit 52fa2b8

Please sign in to comment.