[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ltp-list
Subject:    Re: [LTP]
From:       Mike Frysinger <vapier () gentoo ! org>
Date:       2009-01-21 16:05:26
Message-ID: 200901211105.27464.vapier () gentoo ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Wednesday 21 January 2009 03:57:05 sonic zhang wrote:
> +void generate_fifo_name(char *name)
>  {
> -	return pipe (fd);
> +	char *p;
> +
> +	strcpy(fifo_name, "/tmp/ltp_fifo_");

hardcoding paths is bad ... we already have a function to get a tmpdir i 
thought

> +
> +	p = rindex(name, '/');
> +	if (p == NULL)
> +		p = name;
> +	else
> +		p++;
> +	strncat(fifo_name, p, 255-strlen(fifo_name));

this could easily be simplified with snprintf()

plus, we should avoid using the same exact name in /tmp/ on every run ...
-mike

["signature.asc" (application/pgp-signature)]

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic