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

Daniel.Li daniel_li at usish.com
Mon Apr 27 12:01:44 GMT 2009


On Mon, 2009-04-27 at 13:34 +0200, Petr Uzel wrote:
> 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?

Humm... Thanks for the point.
load_config -> lp_load -> pm_process -> do_parameter

do_parameter compares "motd file", like a key, then assigned
Globals.motd_file =  "/etc/rsync.motd"

Well, NOW, take a close look at motd file, I know, it's something like
welcome message.

And the rsync protocol 30 only support 1024 chars of welcome message.

Thanks :)
> 
> -- 
> 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
-- 
Daniel



More information about the rsync mailing list