DragonFly BSD
DragonFly submit List (threaded) for 2004-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: sh cleanup


From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Tue, 23 Mar 2004 11:12:29 +0100

On Mon, Mar 22, 2004 at 01:44:29PM -0500, Craig Dooley wrote:
> The shell cannot handle some code created by the latest autotools I think,
> so bring in changes from FreeBSD5.  First change removes it's own function 
> copyfd and instead uses dup2.

First a general note. copyfd did some checking on the return value of
fcntl, your dup2 changes don't. The best is IMO to keep copyfd, merge
the close calls into it and do the error checking there.

Second comment above.

Joerg

> 
> -Craig
> -- 
> ------------------------------------------------------------------------
> Craig Dooley                                            craig@xxxxxxxxxx
> ------------------------------------------------------------------------

> Index: bin/sh/input.c
> ===================================================================
> RCS file: /home/dcvs/src/bin/sh/input.c,v
> retrieving revision 1.4
> diff -u -r1.4 input.c
> --- bin/sh/input.c	19 Mar 2004 18:39:41 -0000	1.4
> +++ bin/sh/input.c	22 Mar 2004 17:20:15 -0000
> @@ -382,7 +382,7 @@
>  	if ((fd = open(fname, O_RDONLY)) < 0)
>  		error("Can't open %s: %s", fname, strerror(errno));
>  	if (fd < 10) {
> -		fd2 = copyfd(fd, 10);
> +		fd2 = fcntl(fd, F_DUPFD, 10);

This seems to be a mistake?

>  		close(fd);
>  		if (fd2 < 0)
>  			error("Out of file descriptors");



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]