1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Fixed the detached signature bug.

Minor modifications for W32.
This commit is contained in:
Werner Koch 2000-11-30 12:08:36 +00:00
parent daee3b1d9a
commit 41913b7f01
13 changed files with 136 additions and 27 deletions

View file

@ -1,3 +1,8 @@
2000-11-30 Werner Koch <wk@gnupg.org>
* iobuf.c (iobuf_translate_file_handle): New.
(iobuf_open, iobuf_create): Use it for special filenames
2000-11-11 Paul Eggert <eggert@twinsun.com>
* iobuf.c (iobuf_get_filelength): Now returns off_t, not u32.

View file

@ -1,5 +1,5 @@
/* iobuf.c - file handling
* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@ -620,7 +620,7 @@ iobuf_open( const char *fname )
print_only = 1;
}
else if ( (fd = check_special_filename ( fname )) != -1 )
return iobuf_fdopen ( fd, "rb" );
return iobuf_fdopen ( iobuf_translate_file_handle (fd,0), "rb" );
else if( !(fp = fopen(fname, "rb")) )
return NULL;
a = iobuf_alloc(1, 8192 );
@ -692,7 +692,7 @@ iobuf_create( const char *fname )
print_only = 1;
}
else if ( (fd = check_special_filename ( fname )) != -1 )
return iobuf_fdopen ( fd, "wb" );
return iobuf_fdopen ( iobuf_translate_file_handle (fd, 1), "wb" );
else if( !(fp = fopen(fname, "wb")) )
return NULL;
a = iobuf_alloc(2, 8192 );
@ -1620,3 +1620,20 @@ iobuf_read_line( IOBUF a, byte **addr_of_buffer,
return nbytes;
}
int
iobuf_translate_file_handle ( int fd, int for_write )
{
#ifdef __MINGW32__
{
int x = _open_osfhandle ( (void*)fd, for_write? 1:0 );
if (x==-1 )
log_error ("failed to translate osfhandle %p\n", (void*)fd );
else {
log_info ("_open_osfhandle %p yields %d\n", (void*)fd, x );
fd = x;
}
}
#endif
return fd;
}