Recent changes (master)

Jens Axboe
2016-02-14T13:00:38Z

The following changes since commit e0ee7a8ba4e6badc6cb73814315aa11c15d86ef9:

fio.1: man page fixes (2016-02-12 15:00:39 -0700)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to c0821a08db2fd3e37e16db73c3c4c9c7ff601e88:

Allow for the include file specification to be relative. (2016-02-13 12:31:00 -0700)

----------------------------------------------------------------
Andrey Kuzmin (1):
Allow for the include file specification to be relative.

init.c | 45 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 39 insertions(+), 6 deletions(-)

---

Diff of recent changes:

diff --git a/init.c b/init.c
index 5ee4082..c7ce2cc 100644
--- a/init.c
+++ b/init.c
@@ -1773,15 +1773,48 @@ int __parse_jobs_ini(struct thread_data *td,
strip_blank_end(p);

if (!strncmp(p, "include", strlen("include"))) {
- char *filename = p + strlen("include") + 1;
+ char *filename = p + strlen("include") + 1,
+ *ts, *full_fn = NULL;

- if ((ret = __parse_jobs_ini(td, filename,
- is_buf, stonewall_flag, type, 1,
- name, &opts, &alloc_opts, &num_opts))) {
- log_err("Error %d while parsing include file %s\n",
+ /*
+ * Allow for the include filename
+ * specification to be relative.
+ */
+ if (access(filename, F_OK) &&
+ (ts = strrchr(file, '/'))) {
+ int len = ts - file +
+ strlen(filename) + 2;
+
+ if (!(full_fn = calloc(1, len))) {
+ ret = ENOMEM;
+ break;
+ }
+
+ strncpy(full_fn,
+ file, (ts - file) + 1);
+ strncpy(full_fn + (ts - file) + 1,
+ filename, strlen(filename));
+ full_fn[len - 1] = 0;
+ filename = full_fn;
+ }
+
+ ret = __parse_jobs_ini(td, filename, is_buf,
+ stonewall_flag, type, 1,
+ name, &opts,
+ &alloc_opts, &num_opts);
+
+ if (ret) {
+ log_err("Error %d while parsing "
+ "include file %s\n",
ret, filename);
- break;
}
+
+ if (full_fn)
+ free(full_fn);
+
+ if (ret)
+ break;
+
continue;
}