On Sun, Oct 12, 2014 at 09:20:41PM +0200, A. Schulze wrote:
> >How would Postfix know that "relay" ends at line 2? Comments may
> >appear IN THE MIDDLE of a master.cf entry.
>
> Technically correct.
> I read "line 3" but should read "the entry starting somewhere and end in
> line 3"
It is perhaps sufficient to report the line number of the entry
start. Try the patch below:
diff --git a/src/master/master_ent.c b/src/master/master_ent.c
index 3235996..55ffaf6 100644
--- a/src/master/master_ent.c
+++ b/src/master/master_ent.c
@@ -105,7 +105,8 @@
static char *master_path; /* config file name */
static VSTREAM *master_fp; /* config file pointer */
-static int master_line; /* config file line number */
+static int master_line; /* entry start line number */
+static int master_line_last; /* last read line number */
static ARGV *master_disable; /* disabled service patterns */
static char master_blanks[] = " \t\r\n";/* field delimiters */
@@ -135,7 +136,7 @@ void set_master_ent()
msg_panic("%s: no configuration file specified", myname);
if ((master_fp = vstream_fopen(master_path, O_RDONLY, 0)) == 0)
msg_fatal("open %s: %m", master_path);
- master_line = 0;
+ master_line = master_line_last = 0;
if (master_disable != 0)
msg_panic("%s: service disable list still exists", myname);
if (inet_proto_info()->ai_family_list[0] == 0) {
@@ -288,7 +289,8 @@ MASTER_SERV *get_master_ent()
* Skip blank lines and comment lines.
*/
for (;;) {
- if (readlline(buf, master_fp, &master_line) == 0) {
+ master_line = master_line_last + 1;
+ if (readlline(buf, master_fp, &master_line_last) == 0) {
vstring_free(buf);
vstring_free(junk);
return (0);
--
Viktor.