pmaports/main/keepfileopen/keepfileopen.c
Minecrell 36eb719b51
main/keepfileopen: new aport (MR 1640)
Sometimes it's just nice to open a file, do nothing with it
and keep it open forever. Yay.
2020-10-25 18:35:06 +01:00

19 lines
340 B
C

#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
if (argc != 2) {
fprintf(stderr, "Usage: keepfileopen <file>\n");
return EXIT_FAILURE;
}
if (open(argv[1], O_RDONLY) < 0) {
perror("Failed to open file");
return EXIT_FAILURE;
}
pause();
return EXIT_SUCCESS;
}