[PATCH] start-stop-daemon fails to stop processes and sometimes fails to start them.
Joakim Tjernlund
Joakim.Tjernlund at transmode.se
Sat Apr 19 19:34:00 UTC 2008
> -----Original Message-----
> From: Denys Vlasenko [mailto:vda.linux at googlemail.com]
> Sent: den 19 april 2008 20:54
> To: Joakim Tjernlund
> Cc: busybox at busybox.net
> Subject: Re: [PATCH] start-stop-daemon fails to stop processes and sometimes fails to start them.
>
> On Saturday 19 April 2008 12:32, Joakim Tjernlund wrote:
> > >
> > > > foundany = 0;
> > > > - while ((entry = readdir(procdir)) != NULL) {
> > > > - pid = bb_strtou(entry->d_name, NULL, 10);
> > > > - if (errno)
> > > > + while(1) {
> > > > + errno = 0;
> > > > + entry = readdir(procdir);
> > > > + if (errno) /* Stale file ? */
> > > > continue;
> > >
> > > When exactly this happens? I would like to document it in comment.
> >
> > Well, files comes and goes quickly in /proc so I guess that it
> > happens when a file/directory is deleted after /proc has been opened.
> >
> > The man page for readdir is pretty clear though. Will return a
> > NULL ptr when either EOF or an error has been encountered so
> > you have to test for errno to know why NULL is returned.
>
> Joakim,
Denys,
>
> I am not saying or implying that this change is bad. I do believe that
> people won't send patches just because they like to do so.
well, some do. I don't :)
>
> I think that you saw something in real world usage and you had to make
> this change in order to make it work reliably.
very true, it is not working at all when you try doing lots of
start-stop-demon in a row.
>
> But please realize that your change, as written, will not tell casual
> code reader WHY it is required, and it bears the risk of this code
> being *deleted again* under impression that it is not needed.
>
> In order to prevent that, you have to give at least one real example
> where it is needed.
Well aware of this. Been doing lots of uClibc development in the past.
hmm, I think I did that with my latest round of patches.
> --
> vda
More information about the busybox
mailing list