diff options
Diffstat (limited to 'networking')
-rw-r--r-- | networking/inetd.c | 6 | ||||
-rw-r--r-- | networking/udhcp/files.c | 10 |
2 files changed, 5 insertions, 11 deletions
diff --git a/networking/inetd.c b/networking/inetd.c index 5d37746..a9c9397 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -554,13 +554,9 @@ static void setup(servtab_t *sep) static char *nextline(void) { - char *cp; - if (fgets(line, LINE_SIZE, fconfig) == NULL) return NULL; - cp = strchr(line, '\n'); - if (cp) - *cp = '\0'; + *strchrnul(line, '\n') = '\0'; return line; } diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c index 63c9064..491b887 100644 --- a/networking/udhcp/files.c +++ b/networking/udhcp/files.c @@ -332,14 +332,12 @@ int read_config(const char *file) while (fgets(buffer, READ_CONFIG_BUF_SIZE, in)) { char debug_orig[READ_CONFIG_BUF_SIZE]; - char *p; lm++; - p = strchr(buffer, '\n'); - if (p) *p = '\0'; - if (ENABLE_FEATURE_UDHCP_DEBUG) strcpy(debug_orig, buffer); - p = strchr(buffer, '#'); - if (p) *p = '\0'; + *strchrnul(buffer, '\n') = '\0'; + if (ENABLE_FEATURE_UDHCP_DEBUG) + strcpy(debug_orig, buffer); + *strchrnul(buffer, '#') = '\0'; token = strtok(buffer, " \t"); if (!token) continue; |