On 02/24/09 21:48, Scott Rotondo wrote: > Much better. Thanks for addressing all the suggestions I made earlier. A > few more minor issues: > > * Lines 131-135 will be easier to follow if you reduce them to > > if (status != EXIT_OK && status != EXIT_UNAUTHORIZED) > status = EXIT_FATAL;
Done. I've added one more check to the code, as the existing implementation gives different return codes for doing the same thing, depending on the order of its arguments: $ auths root banana ; echo $? root : solaris.* auths: banana : No such user 1 $ auths banana root ; echo $? auths: banana : No such user root : solaris.* 0 so it now keeps track of failures and returns EXIT_FATAL if any of the users did not exist or if show_auths was unhappy for one reason or another. > * Now that you've moved the get_default_auths() call, you should move > the declarations of defauth_cnt and defauths to show_auths(). Done. > * As Gary already said, it's better to use strdup() in get_username() > instead of reimplementing it yourself. In fact, you can just return > uspw->pw_name (without copying the string) as long as you don't try to > keep using the old value after the next time you call get_username(). > Don't forget to remove the free() at line 231. I've updated the function to use strdup(). Current webrev at http://cr.opensolaris.org/~bartbl/6251549-20090225/. Test output is identical (says diff) to previous runs, so I haven't updated the -testing files. Bart