diff options
author | Werner Koch <[email protected]> | 1997-11-21 14:53:57 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1997-11-21 14:53:57 +0000 |
commit | 2f3cb7e30a56c21f1b5182b6914104ca0c3f8f71 (patch) | |
tree | abb30451cd6f2b6d3c28d0a91b71bc3c04a9f2a2 /util/iobuf.c | |
parent | Output armor works, RSA keygen works. (diff) | |
download | gnupg-2f3cb7e30a56c21f1b5182b6914104ca0c3f8f71.tar.gz gnupg-2f3cb7e30a56c21f1b5182b6914104ca0c3f8f71.zip |
Armor works now
Diffstat (limited to '')
-rw-r--r-- | util/iobuf.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/util/iobuf.c b/util/iobuf.c index 6c4a5f5da..466f07e31 100644 --- a/util/iobuf.c +++ b/util/iobuf.c @@ -249,6 +249,7 @@ iobuf_alloc(int usage, size_t bufsize) a->d.size = bufsize; a->no = ++number; a->subno = 0; + a->opaque = NULL; return a; } @@ -280,7 +281,13 @@ iobuf_close( IOBUF a ) int iobuf_cancel( IOBUF a ) { - /* FIXME: do an unlink if usage is 2 */ + const char *s; + + if( a->usage == 2 ) { + s = iobuf_get_fname(a); + if( s && *s ) + remove(s); /* remove the file. Fixme: this will fail for MSDOZE*/ + } /* because the file is still open */ return iobuf_close(a); } @@ -404,6 +411,7 @@ iobuf_push_filter( IOBUF a, b->recorder.buf = NULL; /* make a link from the new stream to the original stream */ a->chain = b; + a->opaque = b->opaque; /* setup the function on the new stream */ a->filter = f; @@ -734,6 +742,23 @@ iobuf_get_filelength( IOBUF a ) } /**************** + * Retrieve the filename + */ +const char * +iobuf_get_fname( IOBUF a ) +{ + struct stat st; + + for( ; a; a = a->chain ) + if( !a->chain && a->filter == file_filter ) { + file_filter_ctx_t *b = a->filter_ov; + return b->fname; + } + + return NULL; +} + +/**************** * Start the block write mode, see rfc1991.new for details. * A value of 0 for N stops this mode (flushes and writes * the end marker) |