From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Stancek Date: Tue, 26 Apr 2016 12:23:33 -0400 (EDT) Subject: [LTP] [RFC] [PATCH] lib/tst_mkfs: Exit with TCONF on missing mkfs.foo In-Reply-To: <20160426122824.GB6766@rei.lan> References: <20160426110035.GA6780@rei.lan> <781652551.335143.1461671230875.JavaMail.zimbra@redhat.com> <20160426122824.GB6766@rei.lan> Message-ID: <2047893553.473657.1461687813294.JavaMail.zimbra@redhat.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it ----- Original Message ----- > From: "Cyril Hrubis" > To: "Jan Stancek" > 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 >