how can I get the return value of a program executed by exec?

Viewed 19347

I have this c code:

if(fork()==0){
  execl("/usr/bin/fsck", "fsck", "/dev/c0d0p1s0", NULL);
}

it calls execl to run fsck for checking the filesystem /dev/c0d0p1s0.

My question is: how can I get the return value of fsck?

I need the return value of fsck to check whether the file system is consistence or not.

Thank you.

2 Answers
Related