Commit 388c7c18 authored by Mike Hibler's avatar Mike Hibler

If "imageunzip -f" fails (O_DIRECT), automatically try again without -f.

It is pretty unfriendly to make the user run once to see if O_DIRECT
works on the output device, and then run again if it doesn't.
parent 12712c70
......@@ -803,11 +803,22 @@ main(int argc, char *argv[])
flags |= O_DIRECT;
#endif
if ((outfd =
open(argv[1], flags, 0666)) < 0) {
open_again:
outfd = open(argv[1], flags, 0666);
if (outfd < 0) {
if (directio && errno == EINVAL) {
/*
* XXX possibly directio is not supported,
* try again without.
*/
directio = 0;
flags &= ~O_DIRECT;
fprintf(stderr,
"WARNING: open with O_DIRECT failed, "
"trying again without ...\n");
goto open_again;
}
perror("opening output file");
if (directio && errno == EINVAL)
fprintf(stderr, "Try again without -f\n");
exit(1);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment