svn commit: r240770 - in head/usr.sbin/bsdconfig: . console mouse networking networking/share share startup startup/share timezone/share usermgmt/share

Devin Teske devin.teske at fisglobal.com
Fri Sep 21 16:20:55 UTC 2012


On Sep 21, 2012, at 4:36 AM, Jilles Tjoelker wrote:

> On Fri, Sep 21, 2012 at 01:36:20AM +0000, Devin Teske wrote:
>> Author: dteske
>> Date: Fri Sep 21 01:36:20 2012
>> New Revision: 240770
>> URL: http://svn.freebsd.org/changeset/base/240770
> 
>> Log:
>>  Replace redirections to /dev/null with "close file-descriptor" syntax (>&-).
> 
>>  Reviewed by:	adrian (co-mentor)
>>  Approved by:	adrian (co-mentor)
> 
>> [snip]
> 
>> Modified: head/usr.sbin/bsdconfig/bsdconfig
>> ==============================================================================
>> --- head/usr.sbin/bsdconfig/bsdconfig	Fri Sep 21 00:36:35 2012	(r240769)
>> +++ head/usr.sbin/bsdconfig/bsdconfig	Fri Sep 21 01:36:20 2012	(r240770)
>> @@ -73,7 +73,7 @@ usage()
>> 	# Determine the maximum width of terminal/console
>> 	#
>> 	local max_size max_width
>> -	max_size=$( stty size 2> /dev/null )
>> +	max_size=$( stty size 2>&- )
>> 	: ${max_size:="24 80"}
>> 	max_width="${max_size#*[$IFS]}"
>> 	f_dprintf "max_width=[$max_width]"
>> [snip]
> 
> This change is risky because it may cause error messages to be written
> to unexpected files. The first file the utility opens will be fd 2, and
> if something decides to write an error message to fd 2 it will try to
> write to that file.
> 
> For this reason, the kernel will automatically open /dev/null if you
> execute suid/sgid binaries with fd 0, 1 and/or 2 closed.
> 
> Particularly with fd 1 (>&-) there is another danger in that the output
> may fail with [EBADF] rather than being silently discarded. This may
> cause unexpected failures.
> 
> If the reason is that there may be no /dev/null, then you will have to
> change the environment such that there will be a /dev/null.
> 

Jilles and I discussed in IRC and he showed me how I can make /dev/null available in the embedded environment that this was needed for.

I'm going to make another revision that reverses the changes in SVN r240770 (this change).

Thanks Jilles!
-- 
Devin

_____________
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.


More information about the svn-src-head mailing list