// test von posix_spawn /rb #include #include int mySpawn(char *,char *,char *); //---------------------------------------------------- int main(int argc, char *argv[]) { int ret = 0; char *prog = "/usr/bin/avscan"; char *arg = "--batch"; char *buf = "/install/avira/eicar.com"; //char *buf = "/etc/fstab"; ret = mySpawn(prog,arg,buf); printf("exitstatus von avscan: %d\n",ret); return 0; } //---------------------------------------------------- int mySpawn(char *prog,char *arg,char *scanfile) { char* buf1[]={prog,arg,scanfile,NULL}; int ret; int status = -1; pid_t pid; ret = posix_spawn(&pid,buf1[0],NULL,NULL,buf1,NULL); if(ret == 0) { wait(&status); } else { perror("posix_spawn"); } return status ; } //----------------------------------------------------