6
#include <sys/socket.h>
11
void runparent(pid_t child) {
17
readed=read(f[0],buf,254);
18
if (readed>0) writed=write(0,buf,readed);
21
// Waiting for child to be finished!
22
waitpid(child,NULL,0);
29
char buf[100]="Helo!\n\0";
37
if (socketpair(PF_UNIX,SOCK_STREAM,0,f)) {
38
printf("Error creating socket pair, error: %i!\n",errno);
43
if (child>0) runparent(child);
44
else if (child==0) runchild();
45
else printf("Error forking child, error: %i!\n",errno);