On Thu, Feb 02, 2006 at 05:43:49PM +0000, [EMAIL PROTECTED] wrote:
> On Thu Feb 2 11:57:10 CST 2006, [EMAIL PROTECTED] wrote:
> > yes, i supposed it could be something along those lines but i didn't make
> > my point clear.
> > if it is along those lines, it breaks something that even sockets didn't
> > break.
> > at the moment, i get a file descriptor that i can pass to anything that
> > does read and write.
>
> definately not true on linux. udp and netlink sockets would be a counter
> example.
sorry, are you claiming that the attached program (horror.c) does not
work on (some) linux?
this is what in my understanding VJ's stuff would break.
Aki
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
int
main(void)
{
int fd;
struct sockaddr_in sa;
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = htonl(0x7F000001);
sa.sin_port = htons(5555);
switch(fork()){
case 0:
fd = socket(PF_INET, SOCK_DGRAM, 0);
bind(fd, (struct sockaddr*)&sa, sizeof sa);
dup2(fd, 0);
execl("/bin/cat", "cat", NULL);
default:
fd = socket(PF_INET, SOCK_DGRAM, 0);
connect(fd, (struct sockaddr*)&sa, sizeof sa);
dup2(fd, 1);
execl("/bin/cat", "cat", NULL);
}
return 0;
}