tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Short circuit cp -l
In article <69e203a6-fa65-bc01-f00d-da4b3ea9e260%VybeNetworks.com@localhost>,
D'Arcy Cain <darcy%VybeNetworks.com@localhost> wrote:
>Years ago I added the -l option to cp. I was looking at it recently and
>I saw that it was opening and closing the file even though it never did
>anything except link it.
>
>I want to make the following change. Basically it moves the link code
>to the start of the function bypassing all that extra work. I think it
>is safe but thought that I would pass it by others to make sure that I
>am not missing a security hole somewhere.
>
>By the way, a simple test indicates that this change makes an order of
>magnitude speedup to the operation.
Well, the comment needs to be amended, since you don't need to close the
fd's anymore. Other than that it looks fine.
christos
Home |
Main Index |
Thread Index |
Old Index