Re: Init starting twice again
On Mon, 2 Nov 1998, Loic Prylli wrote:
> I just took a look at the code, there seems to be a problem in the
> check_pipe function in sysvinit-2.73/src/init.c
>
>
> char *Signature = "12567362"; /* Signature for re-exec fd */
> [...]
>
> int check_pipe(int fd)
> {
> struct timeval t;
> fd_set s;
> char signature[8];
>
> FD_ZERO(&s);
> FD_SET(fd, &s);
> t.tv_sec = t.tv_usec = 0;
>
> if (select(fd+1, &s, NULL, NULL, &t) != 1)
> return 0;
> if (read(fd, signature, 8) != 8)
> return 0;
> return strcmp(Signature, signature) == 0;
> }
>
> I think signature should be declared as a 9 bytes array, and the ninth
> bye shoudl be set to zero. But I am currently unable to test it :-(
Oh yes, I definately agree, if strcmp returns 0 it is a bloody fluke on
any arch. Could use strncmp too.. I don't actually know what part this
plays in init but can someone fix it?
Jason
Reply to: