[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#5035) Warning patrol

Full_Name: Hallvard B Furuseth
Version: RE23, HEAD
Submission from: (NULL) (
Submitted by: hallvard

#1. slapd/frontend.c:frontend_init() has the statement
	if ( slap_known_controls )
which is always true since slap_known_controls is an array.
Maybe it should be if ( slap_known_controls[0] )?

Except... controls.c says slap_known_controls[0] == NULL, which is
not true - at least not at the time of the if-test above.  What's
that about?

#2.  The return value from op->o_callback->sc_cleanup() is never
used.  Should it be?  I noticed because the pcache_op_cleanup()
function does not return anything.  What should it return?

#3. RE23 struct sync_cookie.rid and struct syncinfo_s.si_rid are
'long', but are printed as 'int'.  Could change the formats, but -
any reason not to instead change their types to 'int' as in HEAD?
I haven't looked at the HEAD syncrepl changes, so I don't know
what other issues might be involved.

#4. bconfig.c: Integer overflow in (1 << (sizeof(int)*8 - 1)) in
slap_loglevel_get().  If anything else have been trusting signed
integer overflow to resemble unsigned integers, it's time to cease
that.  The behaviour is undefined, and compilers make use of this
fact to optimize.

The loglevel functions are confused about types anyway.  They
collect masks in slap_mask_t, but the API uses an int for the
masks.  Either the API should use slap_mask_t or masks should be
stored in (unsigned) ints.  Not for 2.3, I think.

#5. RE23 slurpd/st.c passes a time_t* to lutil_atol() which
expects a long*.

#6. ldbm_db_errcall() has wrong prototype for DB >= 4.3.  Uses
void(const DB_ENV *, const char *, char *) for DB_VERSION_X >=
0x040300, I guess it should copy back-bdb and (a) use const char*
for last param and (b) test for DB_VERSION_FULL instead.
Better late than never, I guess...

#7. Other format bugs:
- slapd/daemon.c: SLAP_EVENT_FD(i) is a ptrdiff_t printed as int.
  I take it SLAP_EPOLL_EV_PTRFD() should return a ber_socket_t
  like in its 'sl_sd' branch.

- libldap/request.c: LDAP* given to %p should be cast to void*.

#7. "Real" warnings drown in void* = function* warnings.  Someday
I want to go through the code and fill in (void*) casts.  That
doesn't make the code more standard, but can shut up compilers.
I don't know if this should be imported to RE23 - maybe the chance
of a new typo is greater than the chance of uncovering a bug:-)