[lxc-devel] [PATCH] Set umask before populating /dev and restore it after.

Stéphane Graber stgraber at ubuntu.com
Tue Jan 8 17:07:55 UTC 2013


On 01/07/2013 10:26 PM, Serge Hallyn wrote:
> Quoting Alexander Vladimirov (alexander.idkfa.vladimirov at gmail.com):
>> According to docs, mknod clears each permission bit whose
>> corresponding bit in the process umask is set, so we should fix it
>> before creating device nodes.
>> ---
> 
> d'oh.  Thank you.
> 
> Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

Pushed to staging.

>>  src/lxc/conf.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
>> index 85d72c9..c0a270f 100644
>> --- a/src/lxc/conf.c
>> +++ b/src/lxc/conf.c
>> @@ -963,6 +963,7 @@ static int setup_autodev(char *root)
>>  	struct lxc_devs *d;
>>  	char path[MAXPATHLEN];
>>  	int i;
>> +	mode_t cmask;
>>  
>>  	INFO("Creating initial consoles under %s/dev\n", root);
>>  
>> @@ -974,6 +975,7 @@ static int setup_autodev(char *root)
>>  		run_makedev(path);
>>  
>>  	INFO("Populating /dev under %s\n", root);
>> +	cmask = umask(S_IXUSR | S_IXGRP | S_IXOTH);
>>  	for (i = 0; i < sizeof(lxc_devs) / sizeof(lxc_devs[0]); i++) {
>>  		d = &lxc_devs[i];
>>  		ret = snprintf(path, MAXPATHLEN, "%s/dev/%s", root, d->name);
>> @@ -985,6 +987,7 @@ static int setup_autodev(char *root)
>>  			return -1;
>>  		}
>>  	}
>> +	umask(cmask);
>>  
>>  	INFO("Populated /dev under %s\n", root);
>>  	return 0;
>> -- 
>> 1.8.1
>>
>>
>> ------------------------------------------------------------------------------
>> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
>> and more. Get SQL Server skills now (including 2012) with LearnDevNow -
>> 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
>> SALE $99.99 this month only - learn more at:
>> http://p.sf.net/sfu/learnmore_122512
>> _______________________________________________
>> Lxc-devel mailing list
>> Lxc-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/lxc-devel
> 
> ------------------------------------------------------------------------------
> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
> and more. Get SQL Server skills now (including 2012) with LearnDevNow -
> 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only - learn more at:
> http://p.sf.net/sfu/learnmore_122512
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
> 


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130108/f4234d01/attachment.pgp>


More information about the lxc-devel mailing list