Commit 0c76b2b1 0c76b2b1a4325a8e96292161ee95523ecb6cbc14 by Sergey Poznyakoff

Fix default nullstream read mode

* libmailutils/stream/nullstream.c (_nullstream_free_pattern): Always
reset pattern and patsize.
(mu_nullstream_create): Fix patsize.
1 parent 00c27bc2
...@@ -66,10 +66,10 @@ _nullstream_free_pattern (struct _mu_nullstream *np) ...@@ -66,10 +66,10 @@ _nullstream_free_pattern (struct _mu_nullstream *np)
66 if (!(np->mode & MU_NULLSTREAM_PATSTAT)) 66 if (!(np->mode & MU_NULLSTREAM_PATSTAT))
67 { 67 {
68 free (np->pattern); 68 free (np->pattern);
69 np->pattern = NULL;
70 np->patsize = 0;
71 np->mode &= ~MU_NULLSTREAM_PATSTAT; 69 np->mode &= ~MU_NULLSTREAM_PATSTAT;
72 } 70 }
71 np->pattern = NULL;
72 np->patsize = 0;
73 } 73 }
74 74
75 static void 75 static void
...@@ -196,8 +196,8 @@ mu_nullstream_create (mu_stream_t *pref, int flags) ...@@ -196,8 +196,8 @@ mu_nullstream_create (mu_stream_t *pref, int flags)
196 np->base.truncate = _nullstream_truncate; 196 np->base.truncate = _nullstream_truncate;
197 np->base.done = _nullstream_done; 197 np->base.done = _nullstream_done;
198 198
199 np->pattern = ""; 199 np->pattern = "\0";
200 np->patsize = 0; 200 np->patsize = 1;
201 np->mode = MU_NULLSTREAM_PATSTAT; 201 np->mode = MU_NULLSTREAM_PATSTAT;
202 202
203 *pref = (mu_stream_t) np; 203 *pref = (mu_stream_t) np;
......