[PATCH]: trivial patch to create zcip.devX.pid
Denys Vlasenko
vda.linux at googlemail.com
Tue Dec 4 02:25:42 PST 2007
On Tuesday 04 December 2007 01:47, Marc Leeman wrote:
> This trivial patch creates a /var/run/zcip.devX.pid pid file in the
> same way udchp does.
+ char pidbuf[BUFSIZ];
+ FILE *fp;
This may eat up to 8k of stack with some libc's
/* Ugly trick, but I want these zeroed in one go */
struct {
@@ -269,6 +271,15 @@
bb_info_msg("start, interface %s", intf);
}
+ /* create pid file that contains the interface name */
+ memset(pidbuf,0x0,BUFSIZ);
+ sprintf(pidbuf,"/var/run/zcip.%s.pid",intf);
The memset is totally pointless.
+ if(fp = fopen_or_warn(pidbuf,"w")){
+ fprintf(fp,"%d\n",getpid());
+ fclose(fp);
+ }
We have write_pidfile("name"), please use that.
> This enables easier firmware controlled 'complex' network
> configuration and re-configuration.
Can you give a hypothetical example where this is useful?
--
vda
More information about the busybox
mailing list