summaryrefslogtreecommitdiffstats
path: root/community-scripts/rename/atomic/reader.c
blob: d25d9d8cdb6482d8da60ef2c1d54a375147916bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
   gcc reader.c -o reader -Wall
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>

int main(void)
{
	int fd;

	for (;;) {
		usleep(rand() % 1000);
		fd = open("dovecot.index", O_RDONLY);
		if (fd == -1) {
			perror("open(dovecot.index)");
			break;
		}
		close(fd);
	}
	return 0;
}