ldapd, fix warnings when compiling with gcc

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ldapd, fix warnings when compiling with gcc

Claudio Jeker
Gcc is unhappy about the void * usage in printf:
search.c:325: warning: format '%s' expects type 'char *', but argument 2 has type 'void *'
search.c:345: warning: format '%.*s' expects type 'char *', but argument 3 has type 'void *'
search.c:365: warning: format '%s' expects type 'char *', but argument 2 has type 'void *'

This diff fixes those. Now neither clang nor gcc complain.
OK?
--
:wq Claudio

Index: search.c
===================================================================
RCS file: /cvs/src/usr.sbin/ldapd/search.c,v
retrieving revision 1.23
diff -u -p -r1.23 search.c
--- search.c 31 Jul 2018 11:01:00 -0000 1.23
+++ search.c 5 Oct 2018 12:30:33 -0000
@@ -322,7 +322,8 @@ conn_search(struct search *search)
  if (search->plan->indexed) {
  search->cindx = TAILQ_FIRST(&search->plan->indices);
  key.data = search->cindx->prefix;
- log_debug("init index scan on [%s]", key.data);
+ log_debug("init index scan on [%s]",
+    search->cindx->prefix);
  } else {
  if (*search->basedn)
  key.data = search->basedn;
@@ -342,7 +343,8 @@ conn_search(struct search *search)
  op = BT_NEXT;
 
  if (rc == BT_SUCCESS && search->plan->indexed) {
- log_debug("found index %.*s", (int)key.size, key.data);
+ log_debug("found index %.*s", (int)key.size,
+    (char *)key.data);
 
  if (!has_prefix(&key, search->cindx->prefix)) {
  log_debug("scanned past index prefix [%s]",
@@ -362,7 +364,8 @@ conn_search(struct search *search)
  memset(&key, 0, sizeof(key));
  key.data = search->cindx->prefix;
  key.size = strlen(key.data);
- log_debug("re-init cursor on [%s]", key.data);
+ log_debug("re-init cursor on [%s]",
+    search->cindx->prefix);
  op = BT_CURSOR;
  continue;
  }

Reply | Threaded
Open this post in threaded view
|

Re: ldapd, fix warnings when compiling with gcc

Philip Guenther-2
On Tue, Dec 4, 2018 at 5:40 AM Claudio Jeker <[hidden email]>
wrote:

> Gcc is unhappy about the void * usage in printf:
> search.c:325: warning: format '%s' expects type 'char *', but argument 2
> has type 'void *'
> search.c:345: warning: format '%.*s' expects type 'char *', but argument 3
> has type 'void *'
> search.c:365: warning: format '%s' expects type 'char *', but argument 2
> has type 'void *'
>
> This diff fixes those. Now neither clang nor gcc complain.
> OK?
>

ok guenther@