stat-loop256.c 648 B

1234567891011121314151617181920212223242526272829303132
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include <stdlib.h>
  4. #include <sys/stat.h>
  5. int main()
  6. {
  7. struct stat statbuf;
  8. int ret = 0;
  9. char* loop255 = "/dev/loop255";
  10. char* loop256 = "/dev/loop256";
  11. mode_t mode = 0660;
  12. mknod(loop255, mode, 0x7ff);
  13. mknod(loop256, mode, 0x100700);
  14. ret = stat(loop255, &statbuf);
  15. if(ret < 0) {
  16. printf("stat: Cant stat %s\n",loop255);
  17. unlink(loop255);
  18. exit(1);
  19. }
  20. ret = stat(loop256, &statbuf);
  21. if(ret < 0) {
  22. printf("stat: Cant stat %s\n",loop256);
  23. unlink(loop255);
  24. unlink(loop256);
  25. exit(1);
  26. }
  27. unlink(loop255);
  28. unlink(loop256);
  29. exit(0);
  30. }