file_check_policy.c 506 B

123456789101112131415161718192021222324252627
  1. #include <errno.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. int main(int argc, char** argv) {
  6. if (argc != 2) {
  7. fprintf(stderr, "Usage: %s file_check_policy_testfile\n", argv[0]);
  8. return 1;
  9. }
  10. FILE* fp = fopen(argv[1], "r");
  11. if (!fp) {
  12. perror("fopen failed");
  13. return 2;
  14. }
  15. int reti = fclose(fp);
  16. if (reti) {
  17. perror("fclose failed");
  18. return 3;
  19. }
  20. printf("file_check_policy succeeded\n");
  21. return 0;
  22. }