aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2001-04-02 18:08:30 +0000
committerWerner Koch <[email protected]>2001-04-02 18:08:30 +0000
commitffb7dd044ad2e09224162d1ce9ebae1c1bf2b406 (patch)
treef7d9b7d18dee90ee3e348cd3711c43005e41234f
parenttypo corrections by [email protected] (diff)
downloadgnupg-ffb7dd044ad2e09224162d1ce9ebae1c1bf2b406.tar.gz
gnupg-ffb7dd044ad2e09224162d1ce9ebae1c1bf2b406.zip
Re-enabled iobuf_translate_file_handle, so that --command-fd et.al continue
to work under W32.
-rw-r--r--util/ChangeLog8
-rw-r--r--util/iobuf.c18
2 files changed, 22 insertions, 4 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 3a6ed109e..f964bdf33 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,11 @@
+2001-04-02 Werner Koch <[email protected]>
+
+ * 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 <[email protected]>
* miscutil.c (answer_is_yes): An empty string does now return no.
diff --git a/util/iobuf.c b/util/iobuf.c
index dd1a2b181..7c0f2d2cc 100644
--- a/util/iobuf.c
+++ b/util/iobuf.c
@@ -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;