aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/ChangeLog5
-rw-r--r--util/fileutil.c4
-rw-r--r--util/iobuf.c11
3 files changed, 13 insertions, 7 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 111a2ae14..04426142b 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-21 Werner Koch <[email protected]>
+
+ * fileutil.c (is_file_compressed): Fix the check for the "-" file
+ name.
+
2003-03-23 David Shaw <[email protected]>
* argparse.c (default_strusage): Change copyright date.
diff --git a/util/fileutil.c b/util/fileutil.c
index b7e7f233b..e19d4bb76 100644
--- a/util/fileutil.c
+++ b/util/fileutil.c
@@ -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 );
diff --git a/util/iobuf.c b/util/iobuf.c
index 415fc6d20..2b1e534a4 100644
--- a/util/iobuf.c
+++ b/util/iobuf.c
@@ -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;
}