Skip to content

Commit

Permalink
fix classic test
Browse files Browse the repository at this point in the history
  • Loading branch information
bortoz committed Nov 9, 2024
1 parent d24a455 commit 47de31d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/tasks/classic/sol/sigsegv.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <errno.h>
#include <malloc.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -14,7 +13,7 @@

char *buffer;

int main(int argc, char *argv[]) {
int main() {
char *p;
int pagesize;

Expand All @@ -23,8 +22,7 @@ int main(int argc, char *argv[]) {

/* Allocate a buffer aligned on a page boundary;
initial protection is PROT_READ | PROT_WRITE */
buffer = memalign(pagesize, 4 * pagesize);
if (buffer == NULL) handle_error("memalign");
if (posix_memalign((void**)&buffer, pagesize, 4 * pagesize)) handle_error("memalign");
if (mprotect(buffer + pagesize * 2, pagesize, PROT_READ) == -1)
handle_error("mprotect");

Expand Down

0 comments on commit 47de31d

Please sign in to comment.