]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- avoid warning about upcast on 32bit systems for autotrust.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 15 Aug 2019 12:25:46 +0000 (14:25 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 15 Aug 2019 12:25:46 +0000 (14:25 +0200)
doc/Changelog
validator/autotrust.c

index ea33f418cc04cf04f797b2c33f917e9128661a7d..5a7221e63906efdfb084c9e721830f534ded3aa5 100644 (file)
@@ -1,6 +1,7 @@
 15 August 2019: Wouter
        - iana portlist updated.
        - Fix autotrust temp file uniqueness windows compile.
+       - avoid warning about upcast on 32bit systems for autotrust.
 
 14 August 2019: George
        - Fix #59, when compiled with systemd support check that we can properly
index 315934cddb365e33241c9a569b9e450bff01d583..fba14ff7c3c7160711be831e346e92e7a2e828d6 100644 (file)
@@ -1175,6 +1175,7 @@ void autr_write_file(struct module_env* env, struct trust_anchor* tp)
 {
        FILE* out;
        char* fname = tp->autr->file;
+       long long llvalue;
        char tempf[2048];
        log_assert(tp->autr);
        if(!env) {
@@ -1183,12 +1184,18 @@ void autr_write_file(struct module_env* env, struct trust_anchor* tp)
        }
        /* unique name with pid number, thread number, and struct pointer
         * (the pointer uniquifies for multiple libunbound contexts) */
+#if defined(SIZE_MAX) && defined(UINT32_MAX) && (UINT32_MAX == SIZE_MAX || INT32_MAX == SIZE_MAX)
+       /* avoid warning about upcast on 32bit systems */
+       llvalue = (unsigned long)tp;
+#else
+       llvalue = (unsigned long long)tp;
+#endif
 #ifndef USE_WINSOCK
        snprintf(tempf, sizeof(tempf), "%s.%d-%d-%llx", fname, (int)getpid(),
-               env->worker?*(int*)env->worker:0, (long long int)tp);
+               env->worker?*(int*)env->worker:0, llvalue);
 #else
        snprintf(tempf, sizeof(tempf), "%s.%d-%d-%I64x", fname, (int)getpid(),
-               env->worker?*(int*)env->worker:0, (long long int)tp);
+               env->worker?*(int*)env->worker:0, llvalue);
 #endif
        verbose(VERB_ALGO, "autotrust: write to disk: %s", tempf);
        out = fopen(tempf, "w");