bin/98625: ypserv ignores the -n option (it always acts like -n has been specified)

Maxim Konovalov maxim at macomnet.ru
Thu Jun 8 05:02:54 PDT 2006


The following reply was made to PR bin/98625; it has been noted by GNATS.

From: Maxim Konovalov <maxim at macomnet.ru>
To: PaulFM <paulfm at me.umn.edu>
Cc: bug-followup at freebsd.org
Subject: Re: bin/98625: ypserv ignores the -n option (it always acts like -n
 has been specified)
Date: Thu, 8 Jun 2006 12:21:47 +0400 (MSD)

 Hi,
 
 >  Looks like a problem with parenthesis (precedence) - or it could be
 >  a bug in the FREEBSD C compiler.  I added 2 sets of parenthesis and
 >  now it works!
 
 I'm sure our compiler is not that broken :-)
 
 >  diff -u yp_server.c ORIG/yp_server.c
 >  ------------------------------------------------------------------------
 >
 >  --- yp_server.c Wed Jun  7 12:30:42 2006
 >  +++ ORIG/yp_server.c    Wed Jun  7 12:29:48 2006
 >  @@ -164,11 +164,11 @@
 >            */
 >
 >    #ifdef DB_CACHE
 >  -       if ((result.stat != YP_TRUE) &&
 >  +       if (result.stat != YP_TRUE &&
 >               (yp_testflag(argp->map, argp->domain, YP_INTERDOMAIN) ||
 >                ((strstr(argp->map, "hosts") || strstr(argp->map, "ipnodes")) && do
 >  _dns))) {
 >    #else
 >  -       if (do_dns && (result.stat != YP_TRUE) &&
 >  +       if (do_dns && result.stat != YP_TRUE &&
 >               (strstr(argp->map, "hosts") || strstr(argp->map, "ipnodes"))) {
 >    #endif
 >                   char                    nbuf[YPMAXRECORD];
 >
 
 Try my instead:
 
 Index: yp_server.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/ypserv/yp_server.c,v
 retrieving revision 1.39
 diff -u -p -r1.39 yp_server.c
 --- yp_server.c	2 May 2005 09:42:59 -0000	1.39
 +++ yp_server.c	8 Jun 2006 08:18:46 -0000
 @@ -164,9 +164,9 @@ ypproc_match_2_svc(ypreq_key *argp, stru
  	 */
 
  #ifdef DB_CACHE
 -	if (result.stat != YP_TRUE &&
 +	if (do_dns && result.stat != YP_TRUE &&
  	    (yp_testflag(argp->map, argp->domain, YP_INTERDOMAIN) ||
 -	     ((strstr(argp->map, "hosts") || strstr(argp->map, "ipnodes")) && do_dns))) {
 +	    (strstr(argp->map, "hosts") || strstr(argp->map, "ipnodes")))) {
  #else
  	if (do_dns && result.stat != YP_TRUE &&
  	    (strstr(argp->map, "hosts") || strstr(argp->map, "ipnodes"))) {
 %%%
 
 -- 
 Maxim Konovalov


More information about the freebsd-bugs mailing list