aboutsummaryrefslogtreecommitdiff
path: root/flags/simple.c
blob: e69e8e5b7d7e12921975a3be5ab90b3168ba649e (plain)
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>

// this one is really simple
int main() {
	int fd;
	char buff[32];
	int len;

	fd = open("simple.not.the.flag", O_RDONLY);
	if(-1 == fd) {
		perror("open failed");
		return -1;
	}
	len = read(fd, buff, sizeof(buff));
	if(len < 0) {
		perror("read failed");
		return -1;
	}
	write(1, buff, len);
	putchar('\n');
	return 0;
}