[Code study]should we remove if (motd && *motd) section?

Daniel.Li daniel_li at usish.com
Mon Apr 27 09:56:17 GMT 2009


Dear List,

I'm confused when we will run into "if (motd && *motd)"? 

As I have found that Globals is set 0 during initialization, and I
didn't find anywhere else assign the value.

If so, should we remove this section? 
Or there might be some where I missed? Please correct me, if I'm wrong.
Thanks in advance.

clientserver.c #line 147~160
> 	if (!am_client) {
> 		motd = lp_motd_file();
> 		if (motd && *motd) {
> 			FILE *f = fopen(motd,"r");
> 			while (f && !feof(f)) {
> 				int len = fread(buf, 1, bufsiz - 1, f);
> 				if (len > 0)
> 					write_buf(f_out, buf, len);
> 			}
> 			if (f)
> 				fclose(f);
> 			write_sbuf(f_out, "\n");
> 		}
> 	}


> static void init_globals(void)
> {
> memset(&Globals, 0, sizeof Globals);
> }
> 



-- 
Daniel



More information about the rsync mailing list