aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog11
-rw-r--r--g10/encode.c6
-rw-r--r--g10/openfile.c10
-rw-r--r--g10/plaintext.c4
-rw-r--r--g10/progress.c2
-rw-r--r--g10/sign.c2
-rw-r--r--g10/tdbdump.c2
7 files changed, 24 insertions, 13 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index bb4371637..b9c31048e 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,14 @@
+2004-10-13 Werner Koch <[email protected]>
+
+ * openfile.c (overwrite_filep, make_outfile_name, open_outfile)
+ (open_sigfile): Use iobuf_is_pipe_filename to check for pipes so
+ that special filesnames are taken into account. This is bug 327.
+ * tdbdump.c (import_ownertrust): Ditto.
+ * sign.c (write_plaintext_packet): Ditto.
+ * progress.c (handle_progress): Ditto.
+ * plaintext.c (handle_plaintext): Ditto.
+ * encode.c (encode_simple, encode_crypt): Ditto.
+
2004-10-12 Werner Koch <[email protected]>
* keygen.c (read_parameter_file): Changed to use iobuf based file
diff --git a/g10/encode.c b/g10/encode.c
index 29b39975e..1a6ca6da7 100644
--- a/g10/encode.c
+++ b/g10/encode.c
@@ -293,8 +293,8 @@ encode_simple( const char *filename, int mode, int use_seskey )
either partial length or fixed length with the new style
messages. */
- if (filename && *filename && !(*filename == '-' && !filename[1])
- && !opt.textmode ) {
+ if ( !iobuf_is_pipe_filename (filename) && filename && *filename
+ && !opt.textmode ) {
off_t tmpsize;
if ( !(tmpsize = iobuf_get_filelength(inp)) )
@@ -582,7 +582,7 @@ encode_crypt( const char *filename, STRLIST remusr, int use_symkey )
}
}
- if (filename && *filename && !(*filename == '-' && !filename[1])
+ if (!iobuf_is_pipe_filename (filename) && *filename
&& !opt.textmode ) {
off_t tmpsize;
diff --git a/g10/openfile.c b/g10/openfile.c
index b3f6e436b..3f52b613b 100644
--- a/g10/openfile.c
+++ b/g10/openfile.c
@@ -64,8 +64,8 @@
int
overwrite_filep( const char *fname )
{
- if( !fname || (*fname == '-' && !fname[1]) )
- return 1; /* writing to stdout is always okay */
+ if( iobuf_is_pipe_filename (fname) )
+ return 1; /* Writing to stdout is always okay */
if( access( fname, F_OK ) )
return 1; /* does not exist */
@@ -98,7 +98,7 @@ make_outfile_name( const char *iname )
{
size_t n;
- if( (!iname || (*iname=='-' && !iname[1]) ))
+ if ( iobuf_is_pipe_filename (iname) )
return m_strdup("-");
n = strlen(iname);
@@ -174,7 +174,7 @@ open_outfile( const char *iname, int mode, IOBUF *a )
int rc = 0;
*a = NULL;
- if( (!iname || (*iname=='-' && !iname[1])) && !opt.outfile ) {
+ if( iobuf_is_pipe_filename (iname) && !opt.outfile ) {
if( !(*a = iobuf_create(NULL)) ) {
log_error(_("%s: can't open: %s\n"), "[stdout]", strerror(errno) );
rc = G10ERR_CREATE_FILE;
@@ -269,7 +269,7 @@ open_sigfile( const char *iname, progress_filter_context_t *pfx )
IOBUF a = NULL;
size_t len;
- if( iname && !(*iname == '-' && !iname[1]) ) {
+ if( !iobuf_is_pipe_filename (iname) ) {
len = strlen(iname);
if( len > 4 && ( !strcmp(iname + len - 4, EXTSEP_S "sig")
|| ( len > 5 && !strcmp(iname + len - 5, EXTSEP_S "sign") )
diff --git a/g10/plaintext.c b/g10/plaintext.c
index e32272232..8918d199c 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -105,8 +105,8 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
if( nooutput )
;
- else if( !*fname || (*fname=='-' && !fname[1])) {
- /* no filename or "-" given; write to stdout */
+ else if ( iobuf_is_pipe_filename (fname) ) {
+ /* No filename or "-" given; write to stdout. */
fp = stdout;
#ifdef HAVE_DOSISH_SYSTEM
setmode ( fileno(fp) , O_BINARY );
diff --git a/g10/progress.c b/g10/progress.c
index bb414faae..42b5ae89e 100644
--- a/g10/progress.c
+++ b/g10/progress.c
@@ -105,7 +105,7 @@ handle_progress (progress_filter_context_t *pfx, IOBUF inp, const char *name)
if (!is_status_enabled ())
return;
- if (name && *name && !(*name == '-' && !name[1]))
+ if ( !iobuf_is_pipe_filename (name) && name && *name )
filesize = iobuf_get_filelength (inp);
else if (opt.set_filesize)
filesize = opt.set_filesize;
diff --git a/g10/sign.c b/g10/sign.c
index 5942fa59b..c2d84459a 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -543,7 +543,7 @@ write_plaintext_packet (IOBUF out, IOBUF inp, const char *fname, int ptmode)
}
/* try to calculate the length of the data */
- if (fname && *fname && !(*fname=='-' && !fname[1])) {
+ if ( !iobuf_is_pipe_filename (fname) && fname && *fname ) {
off_t tmpsize;
if( !(tmpsize = iobuf_get_filelength(inp)) )
diff --git a/g10/tdbdump.c b/g10/tdbdump.c
index b5258a914..559a208aa 100644
--- a/g10/tdbdump.c
+++ b/g10/tdbdump.c
@@ -131,7 +131,7 @@ import_ownertrust( const char *fname )
int rc;
init_trustdb();
- if( !fname || (*fname == '-' && !fname[1]) ) {
+ if( iobuf_is_pipe_filename (fname) ) {
fp = stdin;
fname = "[stdin]";
is_stdin = 1;