Recent changes (master)
The following changes since commit b348b7c7a1a6278d793698fc23993620ae9c588a:
Merge branch 'master' of https://github.com/bvanassche/fio (2018-03-23 09:58:51 -0600)
are available in the git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to d6d74886759e3f268a6a3b12a47872865b867023:
Merge branch 'master' of https://github.com/bvanassche/fio (2018-03-29 10:02:25 -0600)
----------------------------------------------------------------
Bart Van Assche (2):
Make it clear to Coverity that the tmp buffer in switch_ioscheduler() is \0-terminated switch_ioscheduler(): only remove the last character if it's a newline
Jens Axboe (1):
Merge branch 'master' of https://github.com/bvanassche/fio
backend.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
---
Diff of recent changes:
backend.c +7 -5
@@ -1328,7 +1328,7 @@ static int init_io_u(struct thread_data *td)static int switch_ioscheduler (struct thread_data *td) {#ifdef FIO_HAVE_IOSCHED_SWITCH -char tmp[256 ], tmp2[128 ]; +char tmp[256 ], tmp2[128 ], *p;FILE *f;int ret;
@@ -1364,17 +1364,19 @@ static int switch_ioscheduler(struct thread_data *td)/* * Read back and check that the selected scheduler is now the default. */ -memset (tmp,0 ,sizeof (tmp)); - ret =fread (tmp,sizeof (tmp),1 , f); + ret =fread (tmp,1 ,sizeof (tmp) -1 , f);if (ferror (f) || ret <0 ) {td_verror (td, errno,"fread" );fclose (f);return 1 ; } + tmp[ret] ='\0' ;/* -* either a list of io schedulers or "none\n" is expected. +* either a list of io schedulers or "none\n" is expected. Strip the +* trailing newline. */ - tmp[strlen (tmp) -1 ] ='\0' ; + p = tmp; +strsep (&p,"\n" );/* * Write to "none" entry doesn't fail, so check the result here.