ERROR"); exit(" /> ERROR"); exit(" /> ERROR"); exit("/>

execvp does not termiante and it hangs for ever the child process

26 Views Asked by At

I am trying to solve one issue that I have with the below C++ code:

int pid;
int status;
if ((pid = fork()) < 0) {
  ALOGI("1.TEST-POINT->ERROR");
  exit(1);
}
else if (pid == 0) {
  ALOGI("Executing cool");
  char* argument_list[] = {const_cast<char*>("/bin/cool"), const_cast<char*>("/data/cool.bin"), nullptr};
  execvp(const_cast<char*>("/bin/cool"), argument_list)
  ALOGI("Done Executing StoreKeybox");
} else {
  ALOGI("Parent process");
  // TODO:
  // wait for child pid, check status, respond accordingly
  int tpid;
  do {
    tpid = wait(&status);
    if(tpid != pid) process_terminated(tpid);
  } while(tpid != pid);
}

When executing it seems it works rather nice but the cool process never seems to end. When I execute the cool executable manually with the same parameter it works fine and it terminates afterwards.

Any idea what I am doing wrong?

0

There are 0 best solutions below