The previous commit added the support for reading a job file
from stdin, but this breaks when fio uses fgetpos/fsetpos on
the file handle. So remove the seeking.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
unsigned int global;
struct thread_data *td;
char *string, *name;
unsigned int global;
struct thread_data *td;
char *string, *name;
FILE *f;
char *p;
int ret = 0, stonewall;
int first_sect = 1;
FILE *f;
char *p;
int ret = 0, stonewall;
int first_sect = 1;
if (!strcmp(file, "-"))
f = stdin;
if (!strcmp(file, "-"))
f = stdin;
stonewall = stonewall_flag;
do {
stonewall = stonewall_flag;
do {
- p = fgets(string, 4095, f);
- if (!p)
- break;
+ /*
+ * if skip_fgets is set, we already have loaded a line we
+ * haven't handled.
+ */
+ if (!skip_fgets) {
+ p = fgets(string, 4095, f);
+ if (!p)
+ break;
+ }
strip_blank_front(&p);
strip_blank_end(p);
strip_blank_front(&p);
strip_blank_end(p);
while ((p = fgets(string, 4096, f)) != NULL) {
if (is_empty_or_comment(p))
continue;
strip_blank_front(&p);
while ((p = fgets(string, 4096, f)) != NULL) {
if (is_empty_or_comment(p))
continue;
strip_blank_front(&p);
+ /*
+ * new section, break out and make sure we don't
+ * fgets() a new line at the top.
+ */
+ if (p[0] == '[') {
+ skip_fgets = 1;
/*
* Don't break here, continue parsing options so we
* dump all the bad ones. Makes trial/error fixups
/*
* Don't break here, continue parsing options so we
* dump all the bad ones. Makes trial/error fixups
- if (!ret) {
- fsetpos(f, &off);
ret = add_job(td, name, 0);
ret = add_job(td, name, 0);
log_err("fio: job %s dropped\n", name);
put_job(td);
}
log_err("fio: job %s dropped\n", name);
put_job(td);
}