#include
#include
#include
#include
#include
#include
#include
int main()
{
int pid;
int rc;
setsid();
ioctl(0, TIOCSCTTY, 0);
rc = tcsetpgrp(0, getpid());
printf("rc =%d\n",rc);
pid = fork();
if (pid < 0)
{
printf("error\n");
}
if (pid == 0)
{
execlp( "/bin/sh", "sh" ,NULL,NULL,NULL);
}
else
{
wait();
}
return 0;
}
阅读(755) | 评论(0) | 转发(0) |