⬢ DragonFlyBSD Kernel Audit
DF-4749 / holder.c
← back to finding ↓ download raw
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>

int
main(int argc, char **argv)
{
	int fd;

	fd = open(argv[1], O_RDWR | O_NONBLOCK);
	if (fd < 0) {
		printf("holder: open(%s) FAILED: %s\n", argv[1], strerror(errno));
		return (1);
	}
	printf("holder: open(%s)=%d holding 60s\n", argv[1], fd);
	fflush(stdout);
	sleep(60);
	return (0);
}