1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-07 23:27:48 +02:00

* fileutil.c (is_file_compressed): Fix the check for the "-" file

name.
This commit is contained in:
Werner Koch 2003-05-21 08:40:18 +00:00
parent d5afcca57f
commit 905e6b2528
3 changed files with 13 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2003-05-21 Werner Koch <wk@gnupg.org>
* fileutil.c (is_file_compressed): Fix the check for the "-" file
name.
2003-03-23 David Shaw <dshaw@jabberwocky.com>
* argparse.c (default_strusage): Change copyright date.

View File

@ -1,5 +1,5 @@
/* fileutil.c - file utilities
* Copyright (C) 1998 Free Software Foundation, Inc.
* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@ -205,7 +205,7 @@ is_file_compressed( const char *s, int *ret_rc )
{ 4, { 0x50, 0x4b, 0x03, 0x04 } }, /* (pk)zip */
};
if ( !s || *s == '-' || !ret_rc )
if ( !s || (*s == '-' && !s[1]) || !ret_rc )
return 0; /* We can't check stdin or no file was given */
a = iobuf_open( s );

View File

@ -1834,13 +1834,14 @@ iobuf_set_limit( IOBUF a, off_t nlimit )
/****************
* Return the length of an open file
/*
* Return the length of an open file.
*/
off_t
iobuf_get_filelength( IOBUF a )
{
struct stat st;
const char *s;
if( a->directfp ) {
FILE *fp = a->directfp;
@ -1857,18 +1858,18 @@ iobuf_get_filelength( IOBUF a )
file_filter_ctx_t *b = a->filter_ov;
FILEP_OR_FD fp = b->fp;
#if defined(HAVE_DOSISH_SYSTEM) && !defined(FILE_FILTER_USES_STDIO)
#if defined(HAVE_DOSISH_SYSTEM) && !defined(FILE_FILTER_USES_STDIO)
ulong size;
if ( (size=GetFileSize (fp, NULL)) != 0xffffffff )
return size;
log_error ("GetFileSize for handle %p failed: ec=%d\n",
fp, (int)GetLastError () );
#else
#else
if( !fstat(my_fileno(fp), &st) )
return st.st_size;
log_error("fstat() failed: %s\n", strerror(errno) );
#endif
#endif
break;
}