This is the mail archive of the 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: Internal get{pw,gr}XX calls


The attached patch includes the changes to grab_int and parse_grp.
I like your initial idea (a little simplified) better because it 
leaves uid = -1 as a usable value. That may prove useful one day 
(I have some ideas). It also makes parse_pwd somewhat simpler.

strtoul replaces strtol. I have verified that both strtoul("-2",..)
and strtoul("4294967294",..) return 0xFFFFFFFE.

I have kept updating the state to loaded in read_etc_{passwd,group}.

This patch replaces what I sent on Friday. It is incremental over
the earlier big patch involving 9 files.


2002-11-30  Pierre Humblet <>

	* pwdgrp.h (pwdgrp_check::pwdgrp_state): Replace by 
	pwdgrp_check::isinitializing ().
	(pwdgrp_check::isinitializing): Create.
	* (grab_int): Change type to unsigned, use strtoul and 
	set the pointer content to 0 if the field is invalid.
	(parse_pwd): Move validity test after getting pw_gid.
	(read_etc_passwd): Replace "passwd_state <= " by 
	passwd_state::isinitializing ().	
	(internal_getpwuid): Ditto.
	(internal_getpwnam): Ditto.
	(getpwent): Ditto.
	(getpass): Ditto.
	* (parse_grp): Use strtoul for gr_gid and verify the validity.
	(read_etc_group): Replace "group_state <= " by 
	group_state::isinitializing (). 
	(internal_getgrgid): Ditto.
	(getgrent32): Ditto.
	(internal_getgrent): Ditto.

Attachment: pwd2.diff
Description: Text document

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