This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: [PATCH] +groups ignored


On Fri, Jun 27, 2003 at 01:20:52PM +0200, Thorsten Kukuk wrote:
> @@ -300,13 +299,15 @@
>        if (result->gr_name[0] == '+' && result->gr_name[1] != '\0'
>  	  && result->gr_name[1] != '@')
>  	{
> +	  char buf[strlen (result->gr_name)];
>  	  enum nss_status status;
>  
>  	  /* Store the group in the blacklist for the "+" at the end of
>  	     /etc/group */
> -	  blacklist_store_name (&result->gr_name[1], ent);
> +	  strcpy (buf, &result->gr_name[1]);

If you already compute strlen (result->gr_name), wouldn't it be better to
use it then (memcpy is faster than strcpy)?

	size_t len = strlen (result->gr_name);
	char buf[len];
	enum nss_status status;

	strcpy (buf, &result->gr_name[1], len);

	Jakub


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