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. What do u think? > > loadparam.c #line 394 > > > FN_GLOBAL_STRING(lp_motd_file, &Globals.motd_file) > > loadparam.c #line 374~375 > > > > #define FN_GLOBAL_STRING(fn_name,ptr) \ > > char *fn_name(void) {return(*(char **)(ptr) ? *(char **)(ptr) : "");} > > So the function will return "" or it's assigned value. > char *lp_motd_file(void) > { > return(*(char **)(&Globals.motd_file) ? *(char **)(&Globals.motd_file) : > ""); > } > > > > > > Paul > -- > Daniel > Daniel -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html