summaryrefslogtreecommitdiffstats
path: root/bin/sh/eval.c
diff options
context:
space:
mode:
authorcracauer <cracauer@FreeBSD.org>1999-11-29 19:11:01 +0000
committercracauer <cracauer@FreeBSD.org>1999-11-29 19:11:01 +0000
commit903b2c868c14cd85dd3b2e2675969b9cb17f94ea (patch)
tree6ca499c12c2fb731744e3f10743e0e08fdad94e3 /bin/sh/eval.c
parent80af32c97b108dacf6028b29ecae08e5da839113 (diff)
downloadFreeBSD-src-903b2c868c14cd85dd3b2e2675969b9cb17f94ea.zip
FreeBSD-src-903b2c868c14cd85dd3b2e2675969b9cb17f94ea.tar.gz
Include strerror(errno) in error messages after failed system calls.
Fix a warning.
Diffstat (limited to 'bin/sh/eval.c')
-rw-r--r--bin/sh/eval.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c
index 0699a66..4f20822 100644
--- a/bin/sh/eval.c
+++ b/bin/sh/eval.c
@@ -45,6 +45,7 @@ static const char rcsid[] =
#include <signal.h>
#include <unistd.h>
#include <sys/wait.h> /* For WIFSIGNALED(status) */
+#include <errno.h>
/*
* Evaluate a command.
@@ -488,7 +489,7 @@ evalpipe(n)
if (lp->next) {
if (pipe(pip) < 0) {
close(prevfd);
- error("Pipe call failed");
+ error("Pipe call failed: %s", strerror(errno));
}
}
if (forkshell(jp, lp->n, n->npipe.backgnd) == 0) {
@@ -556,7 +557,7 @@ evalbackcmd(n, result)
} else {
exitstatus = 0;
if (pipe(pip) < 0)
- error("Pipe call failed");
+ error("Pipe call failed: %s", strerror(errno));
jp = makejob(n, 1);
if (forkshell(jp, n, FORK_NOJOB) == 0) {
FORCEINTON;
@@ -728,7 +729,7 @@ evalcommand(cmd, flags, backcmd)
if (flags & EV_BACKCMD) {
mode = FORK_NOJOB;
if (pipe(pip) < 0)
- error("Pipe call failed");
+ error("Pipe call failed: %s", strerror(errno));
}
if (forkshell(jp, cmd, mode) != 0)
goto parent; /* at end of routine */
OpenPOWER on IntegriCloud