mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Mainly changes to the pipe handling under W32
This commit is contained in:
parent
41913b7f01
commit
bb1bab488f
9 changed files with 143 additions and 108 deletions
14
util/iobuf.c
14
util/iobuf.c
|
@ -107,8 +107,9 @@ file_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
|
|||
else {
|
||||
clearerr( fp );
|
||||
nbytes = fread( buf, 1, size, fp );
|
||||
if( feof(fp) && !nbytes )
|
||||
if( feof(fp) && !nbytes ) {
|
||||
rc = -1; /* okay: we can return EOF now. */
|
||||
}
|
||||
else if( ferror(fp) && errno != EPIPE ) {
|
||||
log_error("%s: read error: %s\n",
|
||||
a->fname, strerror(errno));
|
||||
|
@ -1626,14 +1627,21 @@ iobuf_translate_file_handle ( int fd, int for_write )
|
|||
{
|
||||
#ifdef __MINGW32__
|
||||
{
|
||||
int x = _open_osfhandle ( (void*)fd, for_write? 1:0 );
|
||||
int x;
|
||||
|
||||
if ( fd <= 2 )
|
||||
return fd; /* do not do this for error, stdin, stdout, stderr */
|
||||
|
||||
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 );
|
||||
/*log_info ("_open_osfhandle %p yields %d%s\n",
|
||||
(void*)fd, x, for_write? " for writing":"" );*/
|
||||
fd = x;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue