Applied with some edits, please test current git.

On Tue, Nov 7, 2023 at 8:37 PM Louai Al-Khanji <[email protected]> wrote:
>
> Apologies for the spam, the previous patch had bad whitespace. Fixed here.
>
> On Tue, Nov 7, 2023 at 11:34 AM Louai Al-Khanji <[email protected]> wrote:
> >
> > Hi all,
> >
> > V3 attached.
> >
> > Rebased against master to account for the -d option. Moves the output
> > variable from the globals struct to be local to main.
> >
> > Thanks,
> > Louai
> >
> > On Tue, Nov 7, 2023 at 10:27 AM Louai Al-Khanji <[email protected]> wrote:
> > >
> > > On Tue, Nov 7, 2023 at 8:03 AM Denys Vlasenko <[email protected]> 
> > > wrote:
> > > >
> > > > On Fri, Nov 3, 2023 at 11:31 PM Louai Al-Khanji <[email protected]> 
> > > > wrote:
> > > > >
> > > > > On Wed, Nov 1, 2023 at 11:53 PM Louai Al-Khanji <[email protected]> 
> > > > > wrote:
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I am interested in implementing the -o|--output option that the 
> > > > > > Debian start-stop-daemon supports. Might such a patch be considered 
> > > > > > for upstreaming?
> > > > > >
> > > > > > Thanks,
> > > > > > Louai
> > > > >
> > > > > Hello,
> > > > >
> > > > > Attached is a proposed patch. Any feedback would be appreciated.
> > > >
> > > > My experiments with ssd version 1.21.22 show that the file is opened 
> > > > with
> > > > O_CREAT|O_APPEND, and it does not allow -O without -b.
> > > >
> > > > If execv fails, error message goes to this file.
> > > > IOW: there is no need to save/restore old stderr fd. Just replace it
> > > > with the new fd
> > > > (and don't forget to not leak any extra open fds).
> > >
> > > Thank you for the feedback everyone. New version attached.
> > >
> > > It looked a little tricky to me to add the logic around
> > > bb_daemon_helper() since it closes open fds. Maybe I am missing
> > > something.
> > >
> > > The code now checks the args more strictly and prints usage if -O is
> > > given without -b.
> > >
> > > I dropped restoring of the stdout/stderr fds. I believe this patch
> > > cannot leak fds.
> > >
> > > One question I have is whether it's okay to lose error messages. On
> > > failure to open the output file I believe the error message currently
> > > goes into the void. Same if any of the dup2 calls or the close call
> > > fails.
> > >
> > > BTW I noticed that bb_daemon_helper() internally calls setsid()
> > > already, so the extra call in start_stop_daemon.c seems superfluous. I
> > > didn't however touch that in this patch.
> > >
> > > Thanks,
> > > Louai
>
> --
>
>
> ________
> This email and any attachments may contain Astranis confidential
> and/or proprietary information governed by a non-disclosure agreement, and
> are intended solely for the individual or entity specified by the message.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to