]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: iostream_rawlog_create_from_stream() now allows input or output to be NULL.
authorTimo Sirainen <tss@iki.fi>
Thu, 23 Apr 2015 08:40:03 +0000 (11:40 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 23 Apr 2015 08:40:03 +0000 (11:40 +0300)
src/lib/iostream-rawlog.c

index 435da5dd92034383ed33419361f2eb19ec0f65c6..3f111e92785f040326bb5df0fb69de3e161779d7 100644 (file)
@@ -285,13 +285,17 @@ void iostream_rawlog_create_from_stream(struct ostream *rawlog_output,
        struct istream *old_input;
        struct ostream *old_output;
 
-       old_input = *input;
-       old_output = *output;
+       if (input != NULL) {
+               old_input = *input;
+               *input = i_stream_create_rawlog_from_stream(old_input,
+                               rawlog_output, rawlog_flags);
+               i_stream_unref(&old_input);
+       }
+       if (output != NULL) {
+               old_output = *output;
+               *output = o_stream_create_rawlog_from_stream(old_output,
+                               rawlog_output, rawlog_flags);
+               o_stream_unref(&old_output);
+       }
        o_stream_ref(rawlog_output);
-       *input = i_stream_create_rawlog_from_stream(old_input, rawlog_output,
-                                                   rawlog_flags);
-       *output = o_stream_create_rawlog_from_stream(old_output, rawlog_output,
-                                                    rawlog_flags);
-       i_stream_unref(&old_input);
-       o_stream_unref(&old_output);
 }