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

Petr Uzel petr.uzel at suse.cz
Mon Apr 27 11:34:41 GMT 2009


On Mon, Apr 27, 2009 at 07:27:38PM +0800, Daniel.Li wrote:
> On Mon, 2009-04-27 at 19:21 +0800, Daniel.Li wrote:
> > On Mon, 2009-04-27 at 12:41 +0200, Paul Slootman wrote:
> > > 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!
> > 
> > Sorry, I forgot to paste below macros. Yes, it's assigned, but this
> > function just returns default("") or global values. But it seems never
> > assigned.
> 
> What I mean is "Globals.motd_file is NEVER assigned". When we use
> default "". Then we still will NOT go into "if (motd && *motd)", as
> *motd == 0.

I'd guess it is assigned in the code that parses configuration file
(rsyncd.conf).

What if you set 'motd file = /etc/rsync.motd' in /etc/rsyncd.conf?

-- 
Best regards / s pozdravem

Petr Uzel, Packages maintainer
---------------------------------------------------------------------
SUSE LINUX, s.r.o.                          e-mail: puzel at suse.cz
Lihovarská 1060/12                          tel: +420 284 028 964
190 00 Prague 9                             fax: +420 284 028 951
Czech Republic                              http://www.suse.cz


More information about the rsync mailing list