This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: setuid on Win95 and etc_changed, passwd & group.


On Wed, Jan 15, 2003 at 09:31:25AM -0500, Pierre A. Humblet wrote:
>Christopher Faylor wrote:
>> I'm not sure what you're saying.  Are you saying it's inefficient
>> because it is duplicated?  I don't see anything wrong with the code.
>
>I believe there are 8 unused bytes in every block.
>On line 221 sz is what's asked + 8.  On line 234 size is sz + 8, or
>what's asked + 16.  The header has size 8, the last 8 bytes will never
>be filled.

Ok.  Got it.  I checked in a patch.

>> In a similar vein,
>> 
>> BOOL isuninitialized () const
>>   {
>>     if (state == uninitialized)
>>       (void) cygheap->etc_changed (me);
>>     return (state == uninitialized);
>>   }
>> 
>> Are both tests for uninitialized necessary?  If not shouldn't it be
>> something like:
>> 
>> BOOL isuninitialized () const
>>   {
>>     if (state != uninitialized)
>>       return false;
>>     (void) cygheap->etc_changed (me);
>>     return true;
>>   }
>
>I like functions with a single return, within reason.
>I thought the compiler would be smart enough not to
>test twice.

Not if there was a etc_changed function call in the middle.

>> Also, could you explain what this 'me' stuff is wrt etc_changed?
>
>That's to go around the problem outlined in the e-mail. Objects
>accessing etc_changed (for now passwd and group) have an ID (me). 
>When an object discovers that etc has changed, it sets a flag for 
>all *other* objects, telling them that etc has already changed
>(see new code in cygheap.cc).

Ok, thanks.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]