diff options
author | Werner Koch <wk@gnupg.org> | 2000-08-18 14:23:17 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2000-08-18 14:23:17 +0200 |
commit | c9c709545aef163b7f9c1e4d7ca01db34f6dab40 (patch) | |
tree | b7683e80e54f04d299f5621870352632d111f907 /util/logger.c | |
parent | See ChangeLog: Mon Jul 31 10:04:47 CEST 2000 Werner Koch (diff) | |
download | gnupg2-c9c709545aef163b7f9c1e4d7ca01db34f6dab40.tar.xz gnupg2-c9c709545aef163b7f9c1e4d7ca01db34f6dab40.zip |
See ChangeLog: Fri Aug 18 14:27:14 CEST 2000 Werner Koch
Diffstat (limited to 'util/logger.c')
-rw-r--r-- | util/logger.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/util/logger.c b/util/logger.c index bb0b89e8b..ccf049f0c 100644 --- a/util/logger.c +++ b/util/logger.c @@ -41,17 +41,19 @@ static FILE *logfp; void log_set_logfile( const char *name, int fd ) { - if( name ) - BUG(); - if( logfp && logfp != stderr && logfp != stdout ) - fclose( logfp ); - if( fd == 1 ) - logfp = stdout; - else if( fd == 2 ) - logfp = stderr; - else - logfp = fdopen( fd, "a" ); + fclose( logfp ); + if( name ) { + logfp = fopen ( name, "a" ); + } + else { + if( fd == 1 ) + logfp = stdout; + else if( fd == 2 ) + logfp = stderr; + else + logfp = fdopen( fd, "a" ); + } if( !logfp ) { logfp = stderr; log_fatal("can't open fd %d for logging: %s\n", fd, strerror(errno)); |