Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F141904033
D54451.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
964 B
Referenced Files
None
Subscribers
None
D54451.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/kstrtox.h b/sys/compat/linuxkpi/common/include/linux/kstrtox.h
--- a/sys/compat/linuxkpi/common/include/linux/kstrtox.h
+++ b/sys/compat/linuxkpi/common/include/linux/kstrtox.h
@@ -249,22 +249,16 @@
static inline int
kstrtobool(const char *s, bool *res)
{
- size_t len;
-
- if (s == NULL || (len = strlen(s)) == 0 || res == NULL)
+ if (s == NULL || *s == '\0')
return (-EINVAL);
- /* skip newline character, if any */
- if (s[len - 1] == '\n')
- len--;
-
- if (len == 1 && strchr("yY1", s[0]) != NULL)
+ if (strchr("eEtTyY1", s[0]) != NULL)
*res = true;
- else if (len == 1 && strchr("nN0", s[0]) != NULL)
+ else if (strchr("dDfFnN0", s[0]) != NULL)
*res = false;
- else if (strncasecmp("on", s, len) == 0)
+ else if (strncasecmp("on", s, 2) == 0)
*res = true;
- else if (strncasecmp("off", s, len) == 0)
+ else if (strncasecmp("of", s, 2) == 0)
*res = false;
else
return (-EINVAL);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 13, 7:17 AM (17 h, 5 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27469884
Default Alt Text
D54451.diff (964 B)
Attached To
Mode
D54451: linuxkpi: Correct kstrtobool
Attached
Detach File
Event Timeline
Log In to Comment