Mercurial > gftp.yaz
diff lib/cache.c @ 60:8a9324fb63a4
2002-11-21 Brian Masney <masneyb@gftp.org>
* lib/protocols.c (gftp_get_next_line) - fixed several bugs
* lib/cache.c - Don't do a cache lookup in gftp_new_cache_entry(). In
gftp_find_cache_entry(), don't log an error to the user if we can't
open up the cache file
* lib/rfc959.c lib/rfc2068.c lib/protocols.c - small cache fixes
* lib/cache.c lib/rfc2068.c lib/rfc959.c - pass full buffer size
instead of buffer size - 1 to gftp_get_line
| author | masneyb |
|---|---|
| date | Fri, 22 Nov 2002 00:54:38 +0000 |
| parents | c01d91c10f6c |
| children | aa971a4bb16f |
line wrap: on
line diff
--- a/lib/cache.c Thu Nov 21 02:49:06 2002 +0000 +++ b/lib/cache.c Fri Nov 22 00:54:38 2002 +0000 @@ -38,9 +38,6 @@ int cache_fd, fd; ssize_t ret; - if ((fd = gftp_find_cache_entry (request)) > 0) - return (fd); - cachedir = expand_path (BASE_CONF_DIR "/cache"); if (access (cachedir, F_OK) == -1) { @@ -127,24 +124,15 @@ indexfile = expand_path (BASE_CONF_DIR "/cache/index.db"); if ((indexfd = open (indexfile, O_RDONLY)) == -1) { - if (request != NULL) - request->logging_function (gftp_logging_error, request->user_data, - _("Error: Cannot open local file %s: %s\n"), - indexfile, g_strerror (errno)); - g_free (indexfile); return (-1); } g_free (indexfile); rbuf = NULL; - while (gftp_get_line (NULL, &rbuf, buf, sizeof (buf) - 1, indexfd) > 0) + while (gftp_get_line (NULL, &rbuf, buf, sizeof (buf), indexfd) > 0) { len = strlen (buf); - if (buf[len - 1] == '\n') - buf[--len] = '\0'; - if (buf[len - 1] == '\r') - buf[--len] = '\0'; if (!((pos = strrchr (buf, '\t')) != NULL && *(pos + 1) != '\0')) continue; @@ -216,13 +204,9 @@ } rbuf = NULL; - while (gftp_get_line (NULL, &rbuf, buf, sizeof (buf) - 1, indexfd) > 0) + while (gftp_get_line (NULL, &rbuf, buf, sizeof (buf), indexfd) > 0) { len = strlen (buf); - if (buf[len - 1] == '\n') - buf[--len] = '\0'; - if (buf[len - 1] == '\r') - buf[--len] = '\0'; if (!((pos = strrchr (buf, '\t')) != NULL && *(pos + 1) != '\0')) continue; @@ -279,13 +263,9 @@ rbuf = NULL; buflen = strlen (description); - while (gftp_get_line (NULL, &rbuf, buf, sizeof (buf) - 1, indexfd) > 0) + while (gftp_get_line (NULL, &rbuf, buf, sizeof (buf), indexfd) > 0) { len = strlen (buf); - if (buf[len - 1] == '\n') - buf[--len] = '\0'; - if (buf[len - 1] == '\r') - buf[--len] = '\0'; if (!((pos = strrchr (buf, '\t')) != NULL && *(pos + 1) != '\0')) {
