- Correctly handle various edge cases in sysfs emulation.
Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
ba397d0f16
commit
3d71c6cf45
@ -97,11 +97,14 @@ sysctl_handle_attr(SYSCTL_HANDLER_ARGS)
|
|||||||
error = -len;
|
error = -len;
|
||||||
if (error != EIO)
|
if (error != EIO)
|
||||||
goto out;
|
goto out;
|
||||||
|
buf[0] = '\0';
|
||||||
|
} else if (len) {
|
||||||
|
len--;
|
||||||
|
if (len >= PAGE_SIZE)
|
||||||
|
len = PAGE_SIZE - 1;
|
||||||
|
/* Trim trailing newline. */
|
||||||
|
buf[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trim trailing newline. */
|
|
||||||
len--;
|
|
||||||
buf[len] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Leave one trailing byte to append a newline. */
|
/* Leave one trailing byte to append a newline. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user