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
Paul Slootman
2009-Apr-27 10:41 UTC
[Code study]should we remove if (motd && *motd) section?
On Mon 27 Apr 2009, Daniel.Li wrote:> > 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.> clientserver.c #line 147~160 > > if (!am_client) { > > motd = lp_motd_file();^^^^^^^^^^^^^^^^^^^^^^> > if (motd && *motd) {It's being assigned the line above the (motd && *motd) part! Paul