diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-04-08 04:20:29 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-04-08 04:20:29 +0000 |
commit | 69acbe9f1d6e5f56b22de23fd1b2a851fbf066f9 (patch) | |
tree | cedcdc7be01a28fbe581588907c163cdec9936b5 /elf | |
parent | 0a7cfefb94e7dda31e058fae59a3cdae211ada5b (diff) | |
download | glibc-69acbe9f1d6e5f56b22de23fd1b2a851fbf066f9.tar.gz glibc-69acbe9f1d6e5f56b22de23fd1b2a851fbf066f9.tar.xz glibc-69acbe9f1d6e5f56b22de23fd1b2a851fbf066f9.zip |
(parse_conf): Ignore leading whitespace. Use feof_unlocked instead of feof. (add_dir): Ignire trailing whitespace.
Diffstat (limited to 'elf')
-rw-r--r-- | elf/ldconfig.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/elf/ldconfig.c b/elf/ldconfig.c index c41c81e3b8..6484e311aa 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -342,13 +342,15 @@ add_dir (const char *line) entry->flag = FLAG_ANY; } - /* Canonify path: for now only remove trailing slashes. */ + /* Canonify path: for now only remove leading and trailing + whitespace and the trailing slashes slashes. */ i = strlen (entry->path) - 1; + + while (isspace (entry->path[i]) && i > 0) + entry->path[i--] = '\0'; + while (entry->path[i] == '/' && i > 0) - { - entry->path[i] = '\0'; - --i; - } + entry->path[i--] = '\0'; if (stat64 (entry->path, &stat_buf)) { @@ -963,12 +965,18 @@ parse_conf (const char *filename) make it terminating the line. */ *strchrnul (line, '#') = '\0'; + /* Remove leading whitespace. NUL is no whitespace character. */ + char *cp = line; + while (isspace (*cp)) + ++cp; + /* If the line is blank it is ignored. */ - if (line[0] == '\0') + if (cp[0] == '\0') continue; - add_dir (line); - } while (!feof (file)); + add_dir (cp); + } + while (!feof_unlocked (file)); /* Free buffer and close file. */ free (line); |