This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] fix wrong comparison in yp_order


Hi,

yp_order always returns 0 for the map order.  The reason is pretty
simple:

int
yp_order (const char *indomain, const char *inmap, unsigned int *outorder)
{
...
  result = do_ypcall_tr (indomain, YPPROC_ORDER, (xdrproc_t) xdr_ypreq_nokey,
			 (caddr_t) &req, (xdrproc_t) xdr_ypresp_order,
			 (caddr_t) &resp);

  if (result == YPERR_SUCCESS)  <=============
    return result;

  *outorder = resp.ordernum;
  xdr_free ((xdrproc_t) xdr_ypresp_order, (char *) &resp);

  return result;
}

That check should actually be !=.  The attached patch addresses this.
Note: I have a build running currently, but have not yet tested it.

Cheers,

Jeff

Index: nis/ypclnt.c
===================================================================
RCS file: /cvs/glibc/libc/nis/ypclnt.c,v
retrieving revision 1.58
diff -u -p -r1.58 ypclnt.c
--- nis/ypclnt.c	28 Apr 2006 16:59:22 -0000	1.58
+++ nis/ypclnt.c	29 Feb 2008 21:42:14 -0000
@@ -634,7 +634,7 @@ yp_order (const char *indomain, const ch
 			 (caddr_t) &req, (xdrproc_t) xdr_ypresp_order,
 			 (caddr_t) &resp);
 
-  if (result == YPERR_SUCCESS)
+  if (result != YPERR_SUCCESS)
     return result;
 
   *outorder = resp.ordernum;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]