summaryrefslogtreecommitdiffstats
path: root/util/logger.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2000-08-18 14:23:17 +0200
committerWerner Koch <wk@gnupg.org>2000-08-18 14:23:17 +0200
commitc9c709545aef163b7f9c1e4d7ca01db34f6dab40 (patch)
treeb7683e80e54f04d299f5621870352632d111f907 /util/logger.c
parentSee ChangeLog: Mon Jul 31 10:04:47 CEST 2000 Werner Koch (diff)
downloadgnupg2-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.c22
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));