diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-12-12 18:13:35 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-12-12 18:13:35 +0000 |
commit | 574e283890a6ca92325a06dafa76ff307a8019a2 (patch) | |
tree | 055e44e24a55fb4863e5d9cdc04e320cde52ffe9 /inet/ether_line.c | |
parent | a162e5955f7e324be82d9318bbcbe869c66ffb86 (diff) |
Updated to fedora-glibc-20071212T1051
Diffstat (limited to 'inet/ether_line.c')
-rw-r--r-- | inet/ether_line.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/inet/ether_line.c b/inet/ether_line.c index 7e871a6bd7..13c5f394cf 100644 --- a/inet/ether_line.c +++ b/inet/ether_line.c @@ -61,19 +61,20 @@ ether_line (const char *line, struct ether_addr *addr, char *hostname) ++line; } - /* Remove trailing white space. */ - cp = __strchrnul (line, '#'); - while (cp > line && isspace (cp[-1])) - --cp; + /* Skip initial whitespace. */ + while (isspace (*line)) + ++line; - if (cp == line) + if (*line == '#' || *line == '\0') /* No hostname. */ return -1; + /* The hostname is up to the next non-space character. */ /* XXX This can cause trouble because the hostname might be too long but we have no possibility to check it here. */ - memcpy (hostname, line, cp - line); - hostname [cp - line] = '\0'; + while (*line != '\0' && *line != '#' && !isspace (*line)) + *hostname++ = *line++; + *hostname = '\0'; return 0; } |