Peter via Postfix-users: > On 16/03/25 16:18, Peter via Postfix-users wrote: > > This is a relatively simple patch, for the sake of simplicity it > > replaces the linefeed at read time, but a slightly more complicated > > patch that does it when lines are output to dst might be more > > appropriate. Note this is untested: > > ...and I realized that the string has to be terminated: > > --- postfix-3.10.1/src/postconf/postconf_edit.c.orig 2025-03-15 > 16:40:20.187982007 +1300 > +++ postfix-3.10.1/src/postconf/postconf_edit.c 2025-03-16 > 16:26:15.607136436 +1300 > @@ -114,7 +114,9 @@ > { > char *cp; > > - while (vstring_get(buf, src) != VSTREAM_EOF) { > + while (vstring_get_nonl(buf, src) != VSTREAM_EOF) { > + VSTRING_ADDCH(buf, '\n'); > + VSTRING_TERMINATE(buf); > if (lineno) > *lineno += 1; > if ((cp = pcf_find_cf_info(buf, dst)) != 0)
That is a plausible solution. An alternative would be much more verbose, like below. No implication that this is better, though. static char *pcf_next_cf_line(VSTRING *buf, VSTREAM *src, VSTREAM *dst, int *lineno) { char *cp; for (;;) { switch (vstring_get(buf, src)) { default: VSTRING_ADDCH(buf, '\n'); VSTRING_TERMINATE(buf); case '\n': if (lineno) *lineno += 1; if ((cp = pcf_find_cf_info(buf, dst)) != 0) return (cp); break; case VSTREAM_EOF: return (0); } } } Wietse _______________________________________________ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org