[klibc] (fwd) dash fix for job control off warning

maximilian attems max at stro.at
Fri Apr 2 07:47:51 PDT 2010


On Fri, Apr 02, 2010 at 10:42:20PM +0800, Herbert Xu wrote:
> On Fri, Apr 02, 2010 at 04:32:20PM +0200, maximilian attems wrote:
> >
> > Pulled this; there seems to be a problem with the new version of dash
> > with job control off.  I can't tell if it is just a warning or is a
> > manifest bug.
> > 
> > The solution is simple:
> > 
> > --- a/usr/dash/jobs.h
> > +++ b/usr/dash/jobs.h
> > @@ -105,5 +105,5 @@ int waitforjob(struct job *);
> >  int stoppedjobs(void);
> > 
> >  #if ! JOBS
> > -#define setjobctl(on)  /* do nothing */
> > +#define setjobctl(on) ((void)(on))     /* do nothing */
> >  #endif
> > 
> > ... to keep the code syntactically valid even when setjobctl() is used
> > as the body of an if statement.
> 
> So when exactly is this needed? Can you give an example?

usr/dash/trap.c: In function `exitshell':
usr/dash/trap.c:376: warning: suggest braces around empty body in an `if' statement

exitshell() has:

        /*
         * Disable job control so that whoever had the foreground before we
         * started can get it back.
         */
        if (likely(!setjmp(loc.loc)))
                setjobctl(0);


aboves patch fixes this gcc warning for me, but I still see:
  KLIBCCC usr/dash/trap.o
usr/dash/trap.c: In function ‘exitshell’:
usr/dash/trap.c:352: warning: variable ‘status’ might be clobbered by ‘longjmp’ or ‘vfork’



More information about the klibc mailing list