1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00

Re-enabled iobuf_translate_file_handle, so that --command-fd et.al continue

to work under W32.
This commit is contained in:
Werner Koch 2001-04-02 18:08:30 +00:00
parent 1da5da4e6b
commit ffb7dd044a
2 changed files with 22 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2001-04-02 Werner Koch <wk@gnupg.org>
* iobuf.c (translate_file_handle): New. Use this function
everywhere in this file.
(iobuf_translate_file_handle): Always use the osfhandle stuff here
because callers don't know the implementation details of iobuf and
they expect that the handles are translated.
2001-03-29 Werner Koch <wk@gnupg.org>
* miscutil.c (answer_is_yes): An empty string does now return no.

View File

@ -120,6 +120,7 @@ typedef struct {
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
@ -1033,7 +1034,7 @@ iobuf_open( const char *fname )
print_only = 1;
}
else if ( (fd = check_special_filename ( fname )) != -1 )
return iobuf_fdopen ( iobuf_translate_file_handle (fd,0), "rb" );
return iobuf_fdopen ( translate_file_handle (fd,0), "rb" );
else if( (fp = my_fopen_ro(fname, "rb")) == INVALID_FP )
return NULL;
a = iobuf_alloc(1, 8192 );
@ -1135,7 +1136,7 @@ iobuf_create( const char *fname )
print_only = 1;
}
else if ( (fd = check_special_filename ( fname )) != -1 )
return iobuf_fdopen ( iobuf_translate_file_handle (fd, 1), "wb" );
return iobuf_fdopen ( translate_file_handle (fd, 1), "wb" );
else if( (fp = my_fopen(fname, "wb")) == INVALID_FP )
return NULL;
a = iobuf_alloc(2, 8192 );
@ -2118,12 +2119,11 @@ iobuf_read_line( IOBUF a, byte **addr_of_buffer,
return nbytes;
}
/* This is the non iobuf specific function */
int
iobuf_translate_file_handle ( int fd, int for_write )
{
#ifdef __MINGW32__
#ifdef FILE_FILTER_USES_STDIO
{
int x;
@ -2139,6 +2139,16 @@ iobuf_translate_file_handle ( int fd, int for_write )
fd = x;
}
}
#endif
return fd;
}
static int
translate_file_handle ( int fd, int for_write )
{
#ifdef __MINGW32__
#ifdef FILE_FILTER_USES_STDIO
fd = iobuf_translate_file_handle (fd, for_write);
#else
{
int x;