mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
(fd_cache_strcmp): New. Use whenever we compare
filenames for the fd_cache. This is needed because the backslash is an alias for a slash under W32. Reported by Tobias Winkler.
This commit is contained in:
parent
9cc9a79047
commit
5bc5baf304
1
THANKS
1
THANKS
@ -197,6 +197,7 @@ Thijmen Klok thijmen@xs4all.nl
|
||||
Thomas Roessler roessler@guug.de
|
||||
Tim Mooney mooney@dogbert.cc.ndsu.nodak.edu
|
||||
Timo Schulz twoaday@freakmail.de
|
||||
Tobias Winkler tobias.winkler@s1998.tu-chemnitz.de
|
||||
Todd Vierling tv@pobox.com
|
||||
TOGAWA Satoshi Satoshi.Togawa@jp.yokogawa.com
|
||||
Tom Spindler dogcow@home.merit.edu
|
||||
|
@ -1,3 +1,9 @@
|
||||
2004-12-06 Werner Koch <wk@g10code.com>
|
||||
|
||||
* iobuf.c (fd_cache_strcmp): New. Use whenever we compare
|
||||
filenames for the fd_cache. This is needed because the backslash
|
||||
is an alias for a slash under W32. Reported by Tobias Winkler.
|
||||
|
||||
2004-12-03 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* http.c (send_request): Include the port if non-80 in the Host:
|
||||
|
26
util/iobuf.c
26
util/iobuf.c
@ -130,8 +130,28 @@ static int special_names_enabled;
|
||||
static int underflow(IOBUF a);
|
||||
static int translate_file_handle ( int fd, int for_write );
|
||||
|
||||
|
||||
|
||||
#ifndef FILE_FILTER_USES_STDIO
|
||||
|
||||
/* This is a replacement for strcmp. Under W32 it does not
|
||||
distinguish between backslash and slash. */
|
||||
static int
|
||||
fd_cache_strcmp (const char *a, const char *b)
|
||||
{
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
for (; *a && *b; a++, b++)
|
||||
{
|
||||
if (*a != *b && !((*a == '/' && *b == '\\')
|
||||
|| (*a == '\\' && *b == '/')) )
|
||||
break;
|
||||
}
|
||||
return *(const unsigned *)a - *(const unsigned *)b;
|
||||
#else
|
||||
return strcmp (a, b);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Invalidate (i.e. close) a cached iobuf
|
||||
*/
|
||||
@ -145,7 +165,7 @@ fd_cache_invalidate (const char *fname)
|
||||
log_debug ("fd_cache_invalidate (%s)\n", fname);
|
||||
|
||||
for (cc=close_cache; cc; cc = cc->next ) {
|
||||
if ( cc->fp != INVALID_FP && !strcmp (cc->fname, fname) ) {
|
||||
if ( cc->fp != INVALID_FP && !fd_cache_strcmp (cc->fname, fname) ) {
|
||||
if( DBG_IOBUF )
|
||||
log_debug (" did (%s)\n", cc->fname);
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
@ -253,7 +273,7 @@ fd_cache_close (const char *fname, FILEP_OR_FD fp)
|
||||
}
|
||||
/* try to reuse a slot */
|
||||
for (cc=close_cache; cc; cc = cc->next ) {
|
||||
if ( cc->fp == INVALID_FP && !strcmp (cc->fname, fname) ) {
|
||||
if ( cc->fp == INVALID_FP && !fd_cache_strcmp (cc->fname, fname) ) {
|
||||
cc->fp = fp;
|
||||
if( DBG_IOBUF )
|
||||
log_debug ("fd_cache_close (%s) used existing slot\n", fname);
|
||||
@ -280,7 +300,7 @@ fd_cache_open (const char *fname, const char *mode)
|
||||
|
||||
assert (fname);
|
||||
for (cc=close_cache; cc; cc = cc->next ) {
|
||||
if ( cc->fp != INVALID_FP && !strcmp (cc->fname, fname) ) {
|
||||
if ( cc->fp != INVALID_FP && !fd_cache_strcmp (cc->fname, fname) ) {
|
||||
FILEP_OR_FD fp = cc->fp;
|
||||
cc->fp = INVALID_FP;
|
||||
if( DBG_IOBUF )
|
||||
|
Loading…
x
Reference in New Issue
Block a user