[LTP] [RFC] [PATCH] lib/tst_mkfs: Exit with TCONF on missing mkfs.foo

Jan Stancek jstancek@redhat.com
Tue Apr 26 18:23:33 CEST 2016





----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Tuesday, 26 April, 2016 2:28:25 PM
> Subject: Re: [LTP] [RFC] [PATCH] lib/tst_mkfs: Exit with TCONF on missing mkfs.foo
> 
> Hi!
> > diff --git a/lib/tst_run_cmd.c b/lib/tst_run_cmd.c
> > index a54d46878940..e58b639e94af 100644
> > --- a/lib/tst_run_cmd.c
> > +++ b/lib/tst_run_cmd.c
> > @@ -71,7 +71,12 @@ int tst_run_cmd_fds_(void (cleanup_fn)(void),
> >                         dup2(stderr_fd, STDERR_FILENO);
> >                 }
> >  
> > -               _exit(execvp(argv[0], (char *const *)argv));
> > +               if (execvp(argv[0], (char *const *)argv) == -1) {
> > +                       if (errno == ENOENT)
> > +                               _exit(255);
> > +                       else
> > +                               _exit(errno);
> 
> I'm not 100% sure if we want to set the errno as an exit value since for
> instance EPERM == 1 which would be indistinguishable from most of the
> command failures.
> 
> Maybe we can exit with 255 on ENOENT and with 254 otherwise.

Fine by me, I just wanted to avoid hiding every error under TCONF.

Regards,
Jan

> 
> --
> Cyril Hrubis
> chrubis@suse.cz
> 


More information about the ltp mailing list