Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/exec.c

    r7e752b2 radb49f58  
    3838#include <stdlib.h>
    3939#include <unistd.h>
    40 #include <str.h>
     40#include <string.h>
    4141#include <fcntl.h>
    42 #include <str_error.h>
    43 #include <errno.h>
    4442
    4543#include "config.h"
     
    117115        task_exit_t texit;
    118116        char *tmp;
    119         int rc, retval;
     117        int retval;
    120118
    121119        tmp = str_dup(find_command(cmd));
    122120        free(found);
    123121
    124         rc = task_spawnv(&tid, tmp, (const char **) argv);
     122        tid = task_spawn((const char *)tmp, argv);
    125123        free(tmp);
    126124
    127         if (rc != 0) {
    128                 cli_error(CL_EEXEC, "%s: Cannot spawn `%s' (%s)", progname, cmd,
    129                     str_error(rc));
     125        if (tid == 0) {
     126                cli_error(CL_EEXEC, "Cannot spawn `%s'.", cmd);
    130127                return 1;
    131128        }
    132129       
    133         rc = task_wait(tid, &texit, &retval);
    134         if (rc != EOK) {
    135                 printf("%s: Failed waiting for command (%s)\n", progname,
    136                     str_error(rc));
    137         } else if (texit != TASK_EXIT_NORMAL) {
    138                 printf("%s: Command failed (unexpectedly terminated)\n", progname);
     130        task_wait(tid, &texit, &retval);
     131        if (texit != TASK_EXIT_NORMAL) {
     132                printf("Command failed (unexpectedly terminated).\n");
    139133        } else if (retval != 0) {
    140                 printf("%s: Command failed (exit code %d)\n",
    141                     progname, retval);
     134                printf("Command failed (return value %d).\n", retval);
    142135        }
    143136
Note: See TracChangeset for help on using the changeset viewer.