Hello there, port-solaris.c:218]: (style) A pointer can not be negative so it is either pointless or an error to check if it is not. Source code is if ((defaultproject = getdefaultproj(pw->pw_name, &tempproject, &buf, sizeof(buf))) > 0) { Maybe better code if ((defaultproject = getdefaultproj(pw->pw_name, &tempproject, &buf, sizeof(buf))) != 0) { Regards David Binderman
Hi David, Yes, IMO it should be changed to `!= 0`.> A pointer can not be negative so it is either pointless or an error tocheck if it is not. That's not quite true, C standard doesn't force a valid pointer to be positive only. It is implementation dependent. All the more reason that the current code is fragile.
On Tue, Oct 25, 2016 at 5:18 PM, David Binderman <dcb314 at hotmail.com> wrote: [...]> Maybe better code > > if ((defaultproject = getdefaultproj(pw->pw_name, &tempproject, &buf, > sizeof(buf))) != 0) {Applied, thanks (although I used NULL rather than bare 0 since that's what the style guide says). -- Darren Tucker (dtucker at zip.com.au) GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new) Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.