Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: smtpd: change the table protocol
To:
Philipp <philipp+openbsd@bureaucracy.de>
Cc:
tech@openbsd.org
Date:
Tue, 30 Apr 2024 10:57:12 +0200

Download raw body.

Thread
On 2024/04/30 10:53:57 +0200, Philipp <philipp+openbsd@bureaucracy.de> wrote:
> >  table_proc_open(struct table *table)
> >  {
> > [...]
> > +	int			 fd, fdd;
> >  
> >  	priv = xcalloc(1, sizeof(*priv));
> >  
> > -	fd = fork_proc_backend("table", table->t_config, table->t_name);
> > +	fd = fork_proc_backend("table", table->t_config, table->t_name, 1);
> >  	if (fd == -1)
> >  		fatalx("table-proc: exiting");
> > +	if ((fdd = dup(fd)) == -1) {
> 
> fdd is only created but not used.
> 
> > +		log_warnx("warn: table-proc: dup");
> > +		fatalx("table-proc: exiting");
> > +	}
> > +	if ((priv->in = fdopen(fd, "r")) == NULL)
> > +		fatalx("table-proc: fdopen");
> > +	if ((priv->out = fdopen(fd, "w")) == NULL)
> > +		fatalx("table-proc: fdopen");
> 
> I guess you wanted to use fdd in one of the fdopen().

Good catch, yes!  Originally I had only one stream, when converting to
two FILEs I missed this, thanks!  fixed in my tree.