You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
static int
vdev_elevator_switch(vdev_t *v, char *elevator)
{
/* ... */
/* Leave existing scheduler when set to "none" */
if (strncmp(elevator, "none", 4) && (strlen(elevator) == 4) == 0)
return (0);
This code is convoluted, with five different equality tests on one line. Testing it in a standalone program it appears to return 0 whenever the 'elevator' input string isn't four characters long. (It looks like the strlen() check was added later in the wrong position.)
I propose this replacement:
if (strcmp(elevator, "none") == 0)
return (0);
Since vdev_elevator_switch() is only ever called with elevator="noop" perhaps this test could be removed anyway.
Thanks
The text was updated successfully, but these errors were encountered:
This code is convoluted, with five different equality tests on one line. Testing it in a standalone program it appears to return 0 whenever the 'elevator' input string isn't four characters long. (It looks like the strlen() check was added later in the wrong position.)
I propose this replacement:
Since vdev_elevator_switch() is only ever called with elevator="noop" perhaps this test could be removed anyway.
Thanks
The text was updated successfully, but these errors were encountered: