]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Fix dependency on -lrt and please lint.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 11 Jul 2014 12:27:20 +0000 (12:27 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 11 Jul 2014 12:27:20 +0000 (12:27 +0000)
git-svn-id: file:///svn/unbound/trunk@3168 be551aaa-1e26-0410-a405-d3ace91eadb9

configure
configure.ac
smallapp/unbound-anchor.c
util/random.c

index 3e25921c1612198387bf5e8e65c6113c51c5256d..e374dc8b0d095356182feefdf989674bb86f7e89 100755 (executable)
--- a/configure
+++ b/configure
@@ -18250,6 +18250,62 @@ esac
 fi
 done
 
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
+$as_echo_n "checking for library containing clock_gettime... " >&6; }
+if ${ac_cv_search_clock_gettime+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' rt; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_clock_gettime=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_clock_gettime+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_clock_gettime+:} false; then :
+
+else
+  ac_cv_search_clock_gettime=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
+$as_echo "$ac_cv_search_clock_gettime" >&6; }
+ac_res=$ac_cv_search_clock_gettime
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
                ;;
                esac
 
index 9c8b1ff82f1673faf5707906fa2ee00d40cc3d94..d2a57e6c1945668c55c3a39de576109da9c476d9 100644 (file)
@@ -997,6 +997,7 @@ if test "$USE_NSS" = "no"; then
                        AC_CHECK_FUNCS([SHA512_Update],,[
                                AC_LIBOBJ(sha512)
                        ])
+                       AC_SEARCH_LIBS([clock_gettime], [rt])
                ;;
                esac
                ])
index f55edd4a192b94433681bd60cbc17d7bea3cfa07..9df0d95b417ce6c550a8575ef2ae7c6b1b410bf8 100644 (file)
@@ -676,7 +676,7 @@ pick_random_ip(struct ip_list* list)
        int sel;
        if(num == 0) return NULL;
        /* not perfect, but random enough */
-       sel = arc4random_uniform(num);
+       sel = (int)arc4random_uniform((uint32_t)num);
        /* skip over unused elements that we did not select */
        while(sel > 0 && p) {
                if(!p->used) sel--;
index a235e722a5dcd43af9a9fd3706f598b5d743c362..71f0ba53e48033c8aacca9dd08fb35ef20d1adfe 100644 (file)
@@ -107,7 +107,7 @@ ub_random_max(struct ub_randstate* state, long int x)
 {
        (void)state;
        /* on OpenBSD, this does not need _seed(), or _stir() calls */
-       return (long)arc4random_uniform(x);
+       return (long)arc4random_uniform((uint32_t)x);
 }
 
 #else