- if (argc >1)
- strcpy(rname, argv[1]);
-
- if ((f = open(rname, O_RDWR)) == -1) {
- fatalError( "freeramdisk: cannot open %s: %s\n", rname, strerror(errno));
- }
- if (ioctl(f, BLKFLSBUF) < 0) {
- fatalError( "freeramdisk: failed ioctl on %s: %s\n", rname, strerror(errno));
+ f = xfopen(argv[1], "r+");
+
+ if (ioctl(fileno(f), BLKFLSBUF) < 0) {
+ perror_msg_and_die("failed ioctl on %s", argv[1]);