mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
See ChangeLog: Wed Jan 13 14:10:15 CET 1999 Werner Koch
This commit is contained in:
parent
615e15dd68
commit
e99e43cd53
32 changed files with 2085 additions and 823 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Jan 13 14:10:15 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
* iobuf.c (iobuf_fdopen): New.
|
||||
|
||||
Sat Jan 9 16:02:23 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
* secmem.c (lock_pool): add another check that setuid() worked.
|
||||
|
|
32
util/iobuf.c
32
util/iobuf.c
|
@ -549,6 +549,38 @@ iobuf_open( const char *fname )
|
|||
return a;
|
||||
}
|
||||
|
||||
/****************
|
||||
* Create a head iobuf for reading from a file
|
||||
* returns: NULL if an error occures and sets errno
|
||||
*/
|
||||
IOBUF
|
||||
iobuf_fdopen( int fd, const char *mode )
|
||||
{
|
||||
IOBUF a;
|
||||
FILE *fp;
|
||||
file_filter_ctx_t *fcx;
|
||||
size_t len;
|
||||
|
||||
if( strchr( mode, 'w' ) )
|
||||
log_bug("iobuf_fdopen: mode `%s' is not supported", mode);
|
||||
|
||||
if( !(fp = fdopen(fd, mode)) )
|
||||
return NULL;
|
||||
a = iobuf_alloc(1, 8192 );
|
||||
fcx = m_alloc( sizeof *fcx + 20 );
|
||||
fcx->fp = fp;
|
||||
fcx->print_only_name = 1;
|
||||
sprintf(fcx->fname, "[fd %d]", fd );
|
||||
a->filter = file_filter;
|
||||
a->filter_ov = fcx;
|
||||
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
|
||||
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
||||
if( DBG_IOBUF )
|
||||
log_debug("iobuf-%d.%d: fdopen `%s'\n", a->no, a->subno, fcx->fname );
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
/****************
|
||||
* create an iobuf for writing to a file; the file will be created.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue