diff --git a/NEWS b/NEWS index 774589a1a..17b4137d4 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,12 @@ * New option -N to insert notations and a --set-policy-url. - * New subcommand "delsig" in th edit menu. + * New subcommand "delsig" in the edit menu. + * The name of the output file is not anymore the one which is + embedded in the processed message, but the used filename with + the extension stripped. To revert to the old behaviour you can + use the option --use-embedded-filename. Noteworthy changes in version 0.9.7 ----------------------------------- diff --git a/TODO b/TODO index dbe27bffb..faba47d65 100644 --- a/TODO +++ b/TODO @@ -37,7 +37,6 @@ Nice to have * replace the keyserver stuff either by a call to a specialized utility and SOCKSify this utility. * Do a real fix for bug #7 or document that it is a PGP 5 error. - * clearsig: Keep lineendings while writing the output of a clearsig * preferences of hash algorithms are not yet used. * new menu to delete signatures and list signature in menu * Replace the SIGUSR1 stuff by semaphores to avoid loss of a signal. @@ -52,8 +51,6 @@ Nice to have * the pubkey encrypt functions should do some sanity checks. * dynload: implement the hint stuff. * "gpg filename.tar.gz.asc" sollte wie mit --verify funktionieren (-sab). - * Den Dateinamen aus der message nicht benutzen, sondern nur - das gpg/asc strippen. * for messages created with "-t", it might make sense to append the verification status of the message to the output (i.e. write something to the --output file and not only to stderr. diff --git a/acconfig.h b/acconfig.h index e3b4f29e7..de4e44f5a 100644 --- a/acconfig.h +++ b/acconfig.h @@ -70,6 +70,9 @@ /* and the real names of the random devices */ #undef NAME_OF_DEV_RANDOM #undef NAME_OF_DEV_URANDOM +/* Linux has an ioctl */ +#undef HAVE_DEV_RANDOM_IOCTL + #undef USE_DYNAMIC_LINKING #undef HAVE_DL_DLOPEN diff --git a/cipher/rndlinux.c b/cipher/rndlinux.c index 8c591fbe8..78fee1567 100644 --- a/cipher/rndlinux.c +++ b/cipher/rndlinux.c @@ -33,6 +33,13 @@ #include #include #include +#if 0 + #ifdef HAVE_LINUX_RANDOM_H + #include + #include + #include + #endif +#endif #include "types.h" #include "util.h" #include "ttyio.h" @@ -48,6 +55,19 @@ static int open_device( const char *name, int minor ); static int gather_random( void (*add)(const void*, size_t, int), int requester, size_t length, int level ); +#if 0 +#ifdef HAVE_DEV_RANDOM_IOCTL +static ulong +get_entropy_count( int fd ) +{ + ulong count; + + if( ioctl( fd, RNDGETENTCNT, &count ) == -1 ) + g10_log_fatal("ioctl(RNDGETENTCNT) failed: %s\n", strerror(errno) ); + return count; +} +#endif +#endif /**************** * Used to open the Linux and xBSD /dev/random devices @@ -91,6 +111,11 @@ gather_random( void (*add)(const void*, size_t, int), int requester, fd = fd_urandom; } + #if 0 + #ifdef HAVE_DEV_RANDOM_IOCTL + g10_log_info("entropy count of %d is %lu\n", fd, get_entropy_count(fd) ); + #endif + #endif while( length ) { fd_set rfds; struct timeval tv; diff --git a/configure.in b/configure.in index a67516c41..2faf657c2 100644 --- a/configure.in +++ b/configure.in @@ -330,20 +330,40 @@ if test "$ac_cv_header_sys_shm_h" = "yes"; then AC_DEFINE(USE_SHM_COPROCESSING) fi +dnl dnl check whether we have a random device +dnl if test "$try_dev_random" = yes ; then -AC_CACHE_CHECK(for random device, ac_cv_have_dev_random, -[if test -c "$NAME_OF_DEV_RANDOM" && test -c "$NAME_OF_DEV_URANDOM" ; then - ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi]) -if test "$ac_cv_have_dev_random" = yes; then - AC_DEFINE(HAVE_DEV_RANDOM) -fi + AC_CACHE_CHECK(for random device, ac_cv_have_dev_random, + [if test -c "$NAME_OF_DEV_RANDOM" && test -c "$NAME_OF_DEV_URANDOM" ; then + ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi]) + if test "$ac_cv_have_dev_random" = yes; then + AC_DEFINE(HAVE_DEV_RANDOM) + fi else AC_MSG_CHECKING(for random device) ac_cv_have_dev_random=no AC_MSG_RESULT(has been disabled) fi +dnl +dnl and whether this device supports ioctl +dnl (Note, that we should do a real test here) +dnl +if test "$ac_cv_have_dev_random" = yes ; then + AC_CHECK_HEADERS(linux/random.h) + AC_CACHE_CHECK(for random device ioctl, ac_cv_have_dev_random_ioctl, + [ if test "$ac_cv_header_linux_random_h" = yes ; then + ac_cv_have_dev_random_ioctl=yes; + else + ac_cv_have_dev_random_ioctl=no; + fi + ]) + if test "$ac_cv_have_dev_random_ioctl" = yes; then + AC_DEFINE(HAVE_DEV_RANDOM_IOCTL) + fi +fi + dnl dnl Figure out the default linkage mode for cipher modules diff --git a/doc/manual.sgml b/doc/manual.sgml index a604d5357..56e8e92b4 100644 --- a/doc/manual.sgml +++ b/doc/manual.sgml @@ -1,26 +1,44 @@ + + ]> - The GNU Privacy Guard + The GNU Privacy Guard Manual + GnuPG-Man + v0.0.0 - Werner Koch -
wk@gnupg.org
-
+ + + Joe + D. + Foo + + joe@somewhere + + + + Werner + Koch + + wk@gnupg.org +
- - 19981998 + + 1999 Free Software Foundation, Inc. + - This documentation is free software; you can redistribute + This manual is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be + This manual is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more @@ -32,61 +50,52 @@ MA 02111-1307 USA For more details see the file COPYING in the source - distribution of GNUPG. + distribution of &gnupg;.
+ + Introduction Feedback + Well, I'm German and I find it hard to express myself in English. So if you find some phrases and/or words that I used in a wrong way (and you will find them :-) ), please send me a mail, to let me correct this. Please send me notes about - typos, too. + typos, too. - What is GNUPG - GNUPG is a free data encryption and signing tool. + What is &gnupg; + &gnupg; is a tool for digital + encryption and signing; + it is part of the GNU Project. - - gpg --version + It has these features: + + + Exciting feature 1 + + + Exciting feature 2 + + - + How to find out the version of &gnupg; + + gpg --version + - - Manual Pages - - These are some short man(1) pages - - - - gpg - 1 - GNU Tools - - - - - gpg - options - file name - - is the GNU tool for signing and encryption - - Description - - - - -
diff --git a/g10/ChangeLog b/g10/ChangeLog index 5096b94fa..f3a51cd4c 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,10 @@ +Tue Jun 1 16:01:46 CEST 1999 Werner Koch + + * openfile.c (make_outfile_name): New. + * plaintext.c (handle_plaintext): Outputfile is now the inputfile + without the suffix. + * g10.c: New option --use-embedded-filename + Mon May 31 19:41:10 CEST 1999 Werner Koch * g10.c (main): Fix for SHM init (Michael). diff --git a/g10/g10.c b/g10/g10.c index eb6d32ff3..acc3f3098 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -144,6 +144,7 @@ enum cmd_and_opt_values { aNull = 0, oRunAsShmCP, oSetFilename, oSetPolicyURL, + oUseEmbeddedFilename, oComment, oThrowKeyid, oForceV3Sigs, @@ -301,6 +302,7 @@ static ARGPARSE_OPTS opts[] = { { oEscapeFrom, "escape-from-lines", 0, "@" }, { oLockOnce, "lock-once", 0, "@" }, { oLoggerFD, "logger-fd",1, "@" }, + { oUseEmbeddedFilename, "use-embedded-filename", 0, "@" }, {0} }; @@ -718,6 +720,7 @@ main( int argc, char **argv ) break; case oSetFilename: opt.set_filename = pargs.r.ret_str; break; case oSetPolicyURL: opt.set_policy_url = pargs.r.ret_str; break; + case oUseEmbeddedFilename: opt.use_embedded_filename = 1; break; case oComment: opt.comment_string = pargs.r.ret_str; break; case oThrowKeyid: opt.throw_keyid = 1; break; case oForceV3Sigs: opt.force_v3_sigs = 1; break; diff --git a/g10/main.h b/g10/main.h index fa03d17a6..5889ccf71 100644 --- a/g10/main.h +++ b/g10/main.h @@ -96,6 +96,7 @@ int generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock ); /*-- openfile.c --*/ int overwrite_filep( const char *fname ); +char *make_outfile_name( const char *iname ); int open_outfile( const char *iname, int mode, IOBUF *a ); IOBUF open_sigfile( const char *iname ); void copy_options_file( const char *destdir ); diff --git a/g10/openfile.c b/g10/openfile.c index e60520adb..af0ab3c1d 100644 --- a/g10/openfile.c +++ b/g10/openfile.c @@ -70,6 +70,36 @@ overwrite_filep( const char *fname ) } +/**************** + * Strip know extensions from iname and return a newly allocated + * filename. Return NULL if we can't do that. + */ +char * +make_outfile_name( const char *iname ) +{ + size_t n; + + if( (!iname || (*iname=='-' && !iname[1]) )) + return m_strdup("-"); + + #ifdef HAVE_DRIVE_LETTERS + #warning add case insensitive compare + #endif + n = strlen(iname); + if( n > 4 && ( !strcmp(iname+n-4,".gpg") + || !strcmp(iname+n-4,".sig") + || !strcmp(iname+n-4,".asc") ) ) { + char *buf = m_strdup( iname ); + buf[n-4] = 0; + return buf; + } + + log_error(_("%s: unknown suffix\n"), iname ); + return NULL; +} + + + /**************** * Make an output filename for the inputfile INAME. * Returns an IOBUF and an errorcode @@ -108,6 +138,7 @@ open_outfile( const char *iname, int mode, IOBUF *a ) mode==2 ? ".sig" : ".gpg"); name = buf; } + if( overwrite_filep( name ) ) { if( !(*a = iobuf_create( name )) ) { log_error(_("%s: can't create: %s\n"), name, strerror(errno) ); @@ -124,6 +155,7 @@ open_outfile( const char *iname, int mode, IOBUF *a ) } + /**************** * Try to open a file without the extension ".sig" or ".asc" * Return NULL if such a file is not available. diff --git a/g10/options.h b/g10/options.h index d40f59fb0..57265f9e4 100644 --- a/g10/options.h +++ b/g10/options.h @@ -76,6 +76,7 @@ struct { int interactive; STRLIST notation_data; const char *set_policy_url; + int use_embedded_filename; } opt; diff --git a/g10/plaintext.c b/g10/plaintext.c index 000ede0c3..1edca16e5 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -63,6 +63,13 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, log_info(_("data not saved; use option \"--output\" to save it\n")); nooutput = 1; } + else if( !opt.use_embedded_filename ) { + fname = make_outfile_name( iobuf_get_real_fname(pt->buf) ); + if( !fname ) { + rc = G10ERR_CREATE_FILE; + goto leave; + } + } else { fname = m_alloc( pt->namelen +1 ); memcpy( fname, pt->name, pt->namelen ); @@ -90,7 +97,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, if( pt->len ) { assert( !clearsig ); - if( convert ) { // text mode + if( convert ) { /* text mode */ for( ; pt->len; pt->len-- ) { if( (c = iobuf_get(pt->buf)) == -1 ) { log_error("Problem reading source (%u bytes remaining)\n", @@ -112,7 +119,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, } } } - else { // binary mode + else { /* binary mode */ byte *buffer = m_alloc( 32768 ); while( pt->len ) { int len = pt->len > 32768 ? 32768 : pt->len; @@ -141,7 +148,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, } } else if( !clearsig ) { - if( convert ) { // text mode + if( convert ) { /* text mode */ while( (c = iobuf_get(pt->buf)) != -1 ) { if( mfx->md ) md_putc(mfx->md, c ); @@ -157,7 +164,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, } } } - else { // binary mode + else { /* binary mode */ byte *buffer = m_alloc( 32768 ); for( ;; ) { int len = iobuf_read( pt->buf, buffer, 32768 ); diff --git a/include/iobuf.h b/include/iobuf.h index fb21badbc..363b09e5b 100644 --- a/include/iobuf.h +++ b/include/iobuf.h @@ -56,6 +56,7 @@ struct iobuf_struct { IOBUF chain, byte *buf, size_t *len); void *filter_ov; /* value for opaque */ int filter_ov_owner; + char *real_fname; IOBUF chain; /* next iobuf used for i/o if any (passed to filter) */ int no, subno; const char *desc; @@ -114,6 +115,7 @@ size_t iobuf_temp_to_buffer( IOBUF a, byte *buffer, size_t buflen ); void iobuf_unget_and_close_temp( IOBUF a, IOBUF temp ); u32 iobuf_get_filelength( IOBUF a ); +const char *iobuf_get_real_fname( IOBUF a ); const char *iobuf_get_fname( IOBUF a ); void iobuf_set_block_mode( IOBUF a, size_t n ); diff --git a/mpi/ChangeLog b/mpi/ChangeLog index db2d7025e..959f3b48c 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,7 @@ +Tue Jun 1 16:01:46 CEST 1999 Werner Koch + + * config.links (i[56]86*-*-freebsdelf*): New. + Sun May 23 14:20:22 CEST 1999 Werner Koch * config.links (sysdep.h): Not any more conditionally created. diff --git a/mpi/config.links b/mpi/config.links index 4caf2b8d6..376d42b71 100644 --- a/mpi/config.links +++ b/mpi/config.links @@ -12,12 +12,12 @@ echo '/* created by config.links - do not edit */' >./mpi/asm-syntax.h if test "$try_asm_modules" = "yes" ; then case "${target}" in - i[34]86*-*-freebsd*-elf | i[34]86*-*-freebsd[34]*) + i[34]86*-*-freebsd*-elf | i[34]86*-*-freebsd[34]* | i[34]86*-*-freebsdelf*) echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h cat $srcdir/mpi/i386/syntax.h >>./mpi/asm-syntax.h path="i386" ;; - i[56]86*-*-freebsd*-elf | i[56]86*-*-freebsd[34]*) + i[56]86*-*-freebsd*-elf | i[56]86*-*-freebsd[34]* | i[56]86*-*-freebsdelf*) echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h cat $srcdir/mpi/i386/syntax.h >>./mpi/asm-syntax.h path="i586 i386" diff --git a/mpi/mpiutil.c b/mpi/mpiutil.c index cbbe10d25..62cb882d6 100644 --- a/mpi/mpiutil.c +++ b/mpi/mpiutil.c @@ -103,6 +103,12 @@ mpi_alloc_secure( unsigned nlimbs ) } +#if 0 +static void *unused_limbs_5; +static void *unused_limbs_32; +static void *unused_limbs_64; +#endif + mpi_ptr_t #ifdef M_DEBUG mpi_debug_alloc_limb_space( unsigned nlimbs, int secure, const char *info ) @@ -111,14 +117,37 @@ mpi_alloc_limb_space( unsigned nlimbs, int secure ) #endif { size_t len = nlimbs * sizeof(mpi_limb_t); + mpi_ptr_t p; if( DBG_MEMORY ) log_debug("mpi_alloc_limb_space(%u)\n", (unsigned)len*8 ); - #ifdef M_DEBUG - return secure? m_debug_alloc_secure(len, info):m_debug_alloc( len, info ); - #else - return secure? m_alloc_secure( len ):m_alloc( len ); + #if 0 + if( !secure ) { + if( nlimbs == 5 && unused_limbs_5 ) { /* DSA 160 bits */ + p = unused_limbs_5; + unused_limbs_5 = *p; + return p; + } + else if( nlimbs == 32 && unused_limbs_32 ) { /* DSA 1024 bits */ + p = unused_limbs_32; + unused_limbs_32 = *p; + return p; + } + else if( nlimbs == 64 && unused_limbs_64 ) { /* DSA 2*1024 bits */ + p = unused_limbs_64; + unused_limbs_64 = *p; + return p; + } + } #endif + + #ifdef M_DEBUG + p = secure? m_debug_alloc_secure(len, info):m_debug_alloc( len, info ); + #else + p = secure? m_alloc_secure( len ):m_alloc( len ); + #endif + + return p; } void @@ -132,6 +161,31 @@ mpi_free_limb_space( mpi_ptr_t a ) return; if( DBG_MEMORY ) log_debug("mpi_free_limb_space of size %lu\n", (ulong)m_size(a)*8 ); + + #if 0 + if( !m_is_secure(a) ) { + size_t nlimbs = m_size(a) / 4 ; + void *p = a; + + if( nlimbs == 5 ) { /* DSA 160 bits */ + *a = unused_limbs_5; + unused_limbs_5 = a; + return; + } + else if( nlimbs == 32 ) { /* DSA 1024 bits */ + *a = unused_limbs_32; + unused_limbs_32 = a; + return; + } + else if( nlimbs == 64 ) { /* DSA 2*1024 bits */ + *a = unused_limbs_64; + unused_limbs_64 = a; + return; + } + } + #endif + + m_free(a); } diff --git a/util/ChangeLog b/util/ChangeLog index e0288e2ef..ad2a85a66 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,8 @@ +Tue Jun 1 16:01:46 CEST 1999 Werner Koch + + * iobuf.c (iobuf_get_real_fname): Made global and now keep a + copy of the name in the iobuf struct. + Mon May 31 19:41:10 CEST 1999 Werner Koch * iobuf.c (file_filter,block_filter): Speed patches (Rémi). diff --git a/util/iobuf.c b/util/iobuf.c index 8e49a1606..e5379d9ce 100644 --- a/util/iobuf.c +++ b/util/iobuf.c @@ -58,7 +58,6 @@ typedef struct { static int underflow(IOBUF a); -static const char *get_real_fname( IOBUF a ); /**************** * Read data from a file into buf which has an allocated length of *LEN. @@ -449,6 +448,7 @@ iobuf_alloc(int use, size_t bufsize) a->no = ++number; a->subno = 0; a->opaque = NULL; + a->real_fname = NULL; return a; } @@ -462,6 +462,7 @@ iobuf_close( IOBUF a ) if( a && a->directfp ) { fclose( a->directfp ); + m_free( a->real_fname ); if( DBG_IOBUF ) log_debug("iobuf_close -> %p\n", a->directfp ); return 0; @@ -477,6 +478,7 @@ iobuf_close( IOBUF a ) if( a->filter && (rc = a->filter(a->filter_ov, IOBUFCTRL_FREE, a->chain, NULL, &dummy_len)) ) log_error("IOBUFCTRL_FREE failed on close: %s\n", g10_errstr(rc) ); + m_free(a->real_fname); m_free(a->d.buf); m_free(a); } @@ -489,7 +491,7 @@ iobuf_cancel( IOBUF a ) const char *s; if( a && a->use == 2 ) { - s = get_real_fname(a); + s = iobuf_get_real_fname(a); if( s && *s ) remove(s); /* remove the file. Fixme: this will fail for MSDOZE*/ } /* because the file is still open */ @@ -550,6 +552,8 @@ iobuf_open( const char *fname ) fcx->fp = fp; fcx->print_only_name = print_only; strcpy(fcx->fname, fname ); + if( !print_only ) + a->real_fname = m_strdup( fname ); a->filter = file_filter; a->filter_ov = fcx; file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len ); @@ -614,6 +618,8 @@ iobuf_create( const char *fname ) fcx->fp = fp; fcx->print_only_name = print_only; strcpy(fcx->fname, fname ); + if( !print_only ) + a->real_fname = m_strdup( fname ); a->filter = file_filter; a->filter_ov = fcx; file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len ); @@ -644,6 +650,7 @@ iobuf_append( const char *fname ) fcx = m_alloc( sizeof *fcx + strlen(fname) ); fcx->fp = fp; strcpy(fcx->fname, fname ); + a->real_fname = m_strdup( fname ); a->filter = file_filter; a->filter_ov = fcx; file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len ); @@ -670,6 +677,7 @@ iobuf_openrw( const char *fname ) fcx = m_alloc( sizeof *fcx + strlen(fname) ); fcx->fp = fp; strcpy(fcx->fname, fname ); + a->real_fname = m_strdup( fname ); a->filter = file_filter; a->filter_ov = fcx; file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len ); @@ -703,6 +711,7 @@ iobuf_fopen( const char *fname, const char *mode ) return NULL; a = iobuf_alloc(1, 8192 ); a->directfp = fp; + a->real_fname = m_strdup( fname ); if( DBG_IOBUF ) log_debug("iobuf_fopen -> %p\n", a->directfp ); @@ -745,6 +754,10 @@ iobuf_push_filter2( IOBUF a, */ b = m_alloc(sizeof *b); memcpy(b, a, sizeof *b ); + /* fixme: it is stupid to keep a copy of the name at every level + * but we need the name somewhere because the name known by file_filter + * may have been released when we need the name of the file */ + b->real_fname = a->real_fname? m_strdup(a->real_fname):NULL; /* remove the filter stuff from the new stream */ a->filter = NULL; a->filter_ov = NULL; @@ -811,6 +824,7 @@ pop_filter( IOBUF a, int (*f)(void *opaque, int control, b = a->chain; assert(b); m_free(a->d.buf); + m_free(a->real_fname); memcpy(a,b, sizeof *a); m_free(b); return 0; @@ -847,6 +861,7 @@ pop_filter( IOBUF a, int (*f)(void *opaque, int control, */ b = a->chain; m_free(a->d.buf); + m_free(a->real_fname); memcpy(a,b, sizeof *a); m_free(b); if( DBG_IOBUF ) @@ -884,6 +899,7 @@ underflow(IOBUF a) log_debug("iobuf-%d.%d: pop `%s' in underflow\n", a->no, a->subno, a->desc ); m_free(a->d.buf); + m_free(a->real_fname); memcpy(a, b, sizeof *a); m_free(b); print_chain(a); @@ -952,6 +968,7 @@ underflow(IOBUF a) a->no, a->subno, a->desc ); print_chain(a); m_free(a->d.buf); + m_free(a->real_fname); memcpy(a,b, sizeof *a); m_free(b); print_chain(a); @@ -1075,18 +1092,22 @@ iobuf_read(IOBUF a, byte *buf, unsigned buflen ) do { if( n < buflen && a->d.start < a->d.len ) { unsigned size = a->d.len - a->d.start; - if( size > buflen - n ) size = buflen - n; - if( buf ) memcpy( buf, a->d.buf + a->d.start, size ); + if( size > buflen - n ) + size = buflen - n; + if( buf ) + memcpy( buf, a->d.buf + a->d.start, size ); n += size; a->d.start += size; - if( buf ) buf += size; + if( buf ) + buf += size; } if( n < buflen ) { if( (c=underflow(a)) == -1 ) { a->nbytes += n; return n? n : -1/*EOF*/; } - if( buf ) *buf++ = c; + if( buf ) + *buf++ = c; n++; } } while( n < buflen ); @@ -1251,6 +1272,7 @@ iobuf_get_filelength( IOBUF a ) return 0; } + /* Hmmm: file_filter may have already been removed */ for( ; a; a = a->chain ) if( !a->chain && a->filter == file_filter ) { file_filter_ctx_t *b = a->filter_ov; @@ -1331,9 +1353,13 @@ iobuf_seek( IOBUF a, ulong newpos ) /**************** * Retrieve the real filename */ -static const char * -get_real_fname( IOBUF a ) +const char * +iobuf_get_real_fname( IOBUF a ) { + if( a->real_fname ) + return a->real_fname; + + /* the old solution */ for( ; a; a = a->chain ) if( !a->chain && a->filter == file_filter ) { file_filter_ctx_t *b = a->filter_ov; diff --git a/util/memory.c b/util/memory.c index ebf8f8893..40784375d 100644 --- a/util/memory.c +++ b/util/memory.c @@ -48,9 +48,10 @@ #define EXTRA_ALIGN 0 #endif -static void membug( const char *fmt, ... ); #ifdef M_DEBUG + static void membug( const char *fmt, ... ); + #ifndef M_GUARD #define M_GUARD 1 #endif @@ -318,7 +319,6 @@ check_allmem( const char *info ) check_mem(e->user_p-4-EXTRA_ALIGN, info); } -#endif /* M_DEBUG */ static void membug( const char *fmt, ... ) @@ -337,6 +337,7 @@ membug( const char *fmt, ... ) abort(); } +#endif /* M_DEBUG */ void m_print_stats( const char *prefix )