> Date: Fri, 15 Apr 2011 10:12:19 -0400
> From: David Boyce <david.s.bo...@gmail.com>
> Cc: Eli Zaretskii <e...@gnu.org>, bug-make@gnu.org
> 
> Attached is an updated patch with some improvements:

Thanks.

> - It uses stdout as its semaphore.

Can Make be invoked with its stdout closed by the parent process?  If
it is, will this still work?

> +  memset(&fl, 0, sizeof(fl));
> +  fl.l_type = F_WRLCK;
> +  fl.l_whence = SEEK_SET;
> +  fl.l_pid = getpid();
> +  fl.l_start = fl.l_len = 0;
> +  if (fcntl(syncfd, F_SETLKW, &fl) == -1)
> +    perror("fcntl");

As discussed, please factor this out into a separate function.

> +      if (c->tempout)
> +     while ((nread = fread(buffer, 1, sizeof(buffer), c->tempout)) > 0)
> +       write(fileno(stdout), buffer, nread);

Are we sure c->tempout will be zeroed out by initialization?

> +  if (c->tempout)
> +      fclose(c->tempout);
> +  if (c->temperr)
> +      fclose(c->temperr);

Should we assign NULL to these once they are closed?

_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to