summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hid.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hid.c b/hid.c
index 345a1a8..d98bc8f 100644
--- a/hid.c
+++ b/hid.c
@@ -1,4 +1,3 @@
-#define _GNU_SOURCE
#include <sys/types.h>
#include <dirent.h>
#include <fnmatch.h>
@@ -49,7 +48,9 @@ static char *get_field_value(const char *fields, const char *field_name)
modalias = strstr(fields, field_name);
if (modalias == NULL)
return NULL;
- end = strchrnul(modalias, '\n');
+ end = strchr(modalias, '\n');
+ if (end == NULL)
+ end = modalias + strlen(modalias);
return strndup(modalias+strlen(field_name), end - (modalias+strlen(field_name)));
}