ash: more s/error/perror/ for better error reporting
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 23 Aug 2017 12:52:56 +0000 (14:52 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 23 Aug 2017 12:52:56 +0000 (14:52 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c

index 60bcd1b0a949ee60a7fade54292aea74f9cb291b..3fa7f4d9f62cc8c76d15a4a7e63d4e7e77389b6f 100644 (file)
@@ -4994,7 +4994,7 @@ forkchild(struct job *jp, union node *n, int mode)
                if (jp->nprocs == 0) {
                        close(0);
                        if (open(bb_dev_null, O_RDONLY) != 0)
-                               ash_msg_and_raise_error("can't open '%s'", bb_dev_null);
+                               ash_msg_and_raise_perror("can't open '%s'", bb_dev_null);
                }
        }
        if (oldlvl == 0) {
@@ -5083,7 +5083,7 @@ forkshell(struct job *jp, union node *n, int mode)
                TRACE(("Fork failed, errno=%d", errno));
                if (jp)
                        freejob(jp);
-               ash_msg_and_raise_error("can't fork");
+               ash_msg_and_raise_perror("can't fork");
        }
        if (pid == 0) {
                CLEAR_RANDOM_T(&random_gen); /* or else $RANDOM repeats in child */
@@ -5226,7 +5226,7 @@ openhere(union node *redir)
        size_t len = 0;
 
        if (pipe(pip) < 0)
-               ash_msg_and_raise_error("pipe call failed");
+               ash_msg_and_raise_perror("can't create pipe");
        if (redir->type == NHERE) {
                len = strlen(redir->nhere.doc->narg.text);
                if (len <= PIPE_BUF) {
@@ -6288,7 +6288,7 @@ evalbackcmd(union node *n, struct backcmd *result)
        }
 
        if (pipe(pip) < 0)
-               ash_msg_and_raise_error("pipe call failed");
+               ash_msg_and_raise_perror("can't create pipe");
        jp = makejob(/*n,*/ 1);
        if (forkshell(jp, n, FORK_NOJOB) == 0) {
                /* child */
@@ -9180,7 +9180,7 @@ evalpipe(union node *n, int flags)
                if (lp->next) {
                        if (pipe(pip) < 0) {
                                close(prevfd);
-                               ash_msg_and_raise_error("pipe call failed");
+                               ash_msg_and_raise_perror("can't create pipe");
                        }
                }
                if (forkshell(jp, lp->n, n->npipe.pipe_backgnd) == 0) {