login.c bug?

Luciano Miguel Ferreira Rocha strange at nsk.no-ip.org
Thu Oct 12 13:10:48 UTC 2006


On Thu, Oct 12, 2006 at 10:38:09AM +0200, Cristian Ionescu-Idbohrn wrote:
> The statement [1] in functions: read_or_build_utent and write_utent
> is (IMHO) nonsensical.
> 
> Function read_or_build_utent: the utent structure is 1st zeroed (using
> memset) and then zeroed [1] again. Does it need to?

[1] doesn't zero utent. "utent.ut_time = time(NULL)" sets utent.ut_time
to the current time.

> I would have expected something like:
> 
> 	if (time(&utent.ut_time) == -1) {
> 		<error handling>
> 	}

tim only returns an error when the pointer passed as 1st argument to it
points to an invalid address. That's never the case when using the [1]
form instead of the one you just presented.
 
--
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20061012/3653b433/attachment-0002.pgp 


More information about the busybox mailing list