mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-12-03 17:14:21 +08:00
textfile: find_key parsing nit
The find_key function should return a pointer to the begining of the line in the config file (map) that has the given keyword. This patch fixes a wrong logic when the another keyword has the given keyword as a prefix and appears in the first line of the file.
This commit is contained in:
parent
8c0e4bd6a4
commit
ed881174ca
@ -101,7 +101,7 @@ static inline char *find_key(char *map, size_t size, const char *key, size_t len
|
||||
while (ptrlen > len + 1) {
|
||||
int cmp = (icase) ? strncasecmp(ptr, key, len) : strncmp(ptr, key, len);
|
||||
if (cmp == 0) {
|
||||
if (ptr == map)
|
||||
if (ptr == map && *(ptr + len) == ' ')
|
||||
return ptr;
|
||||
|
||||
if ((*(ptr - 1) == '\r' || *(ptr - 1) == '\n') &&
|
||||
|
Loading…
Reference in New Issue
Block a user