X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=backend.c;h=207b509d2698f724baf44b94b4a0518ba065b737;hp=2aa88403da00600c5a1b8713572aa5840eb7dba3;hb=b44b9e45cf38;hpb=c44ff5115df69f0040aef9677bf48966d72adb81 diff --git a/backend.c b/backend.c index 2aa88403..207b509d 100644 --- a/backend.c +++ b/backend.c @@ -1172,13 +1172,17 @@ 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); if (ferror(f) || ret < 0) { td_verror(td, errno, "fread"); fclose(f); return 1; } - tmp[sizeof(tmp) - 1] = '\0'; + /* + * either a list of io schedulers or "none\n" is expected. + */ + tmp[strlen(tmp) - 1] = '\0'; sprintf(tmp2, "[%s]", td->o.ioscheduler);