@@ -285,12 +285,14 @@ pwrite_f(
int direction = IO_FORWARD;
int c, fd = -1;
int pwritev2_flags = 0;
+ bool fail = false;
+ char *orig_io_buffer = NULL;
Cflag = qflag = uflag = dflag = wflag = Wflag = 0;
init_cvtnum(&fsblocksize, &fssectsize);
bsize = fsblocksize;
- while ((c = getopt(argc, argv, "b:BCdDf:Fi:NqRs:OS:uV:wWZ:")) != EOF) {
+ while ((c = getopt(argc, argv, "b:BCdDfFi:NqRs:OS:uV:wWZ:")) != EOF) {
switch (c) {
case 'b':
tmp = cvtnum(fsblocksize, fssectsize, optarg);
@@ -320,6 +322,8 @@ pwrite_f(
dflag = 1;
break;
case 'f':
+ fail = true;
+ break;
case 'i':
infile = optarg;
break;
@@ -414,6 +418,10 @@ pwrite_f(
exitcode = 1;
return 0;
}
+ if (fail) {
+ orig_io_buffer = io_buffer;
+ io_buffer = NULL;
+ }
c = IO_READONLY | (dflag ? IO_DIRECT : 0);
if (infile && ((fd = openfile(infile, NULL, c, 0, NULL)) < 0)) {
@@ -471,6 +479,8 @@ pwrite_f(
done:
if (infile)
close(fd);
+ if (orig_io_buffer)
+ io_buffer = orig_io_buffer;
return 0;
}