diff options
author | Jeff Trawick <trawick@apache.org> | 2005-06-02 20:24:27 +0200 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2005-06-02 20:24:27 +0200 |
commit | 45e47b1a12140e882c0a76890976278e379d9df1 (patch) | |
tree | 31952b64e97a7aa3e127f2d73bb4411847e20c5a /modules/metadata | |
parent | - Fix style nits in the new hash config code. No Functional changes. (diff) | |
download | apache2-45e47b1a12140e882c0a76890976278e379d9df1.tar.xz apache2-45e47b1a12140e882c0a76890976278e379d9df1.zip |
mod_mime_magic: Handle CRLF-format magic files so that it works with
the default installation on Windows.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@179622 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/metadata')
-rw-r--r-- | modules/metadata/mod_mime_magic.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/modules/metadata/mod_mime_magic.c b/modules/metadata/mod_mime_magic.c index 4cb096ea61..f4ca7207b2 100644 --- a/modules/metadata/mod_mime_magic.c +++ b/modules/metadata/mod_mime_magic.c @@ -947,12 +947,17 @@ static int apprentice(server_rec *s, apr_pool_t *p) /* parse it */ for (lineno = 1; apr_file_gets(line, BUFSIZ, f) == APR_SUCCESS; lineno++) { int ws_offset; + char *last = line + strlen(line) - 1; /* guaranteed that len >= 1 */ - /* delete newline */ - if (line[0]) { - line[strlen(line) - 1] = '\0'; - } - + /* delete newline and potential carriage return */ + if (*last == '\n') { + *last = '\0'; + --last; + } + if (*last == '\r') { + *last = '\0'; + } + /* skip leading whitespace */ ws_offset = 0; while (line[ws_offset] && apr_isspace(line[ws_offset])) { |