]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3456] Use uintptr_t rather than size_t to store an integer in a pointer
authorJuergen Perlinger <perlinger@ntp.org>
Mon, 12 Mar 2018 15:36:51 +0000 (16:36 +0100)
committerJuergen Perlinger <perlinger@ntp.org>
Mon, 12 Mar 2018 15:36:51 +0000 (16:36 +0100)
bk: 5aa69e93pthCwAca3XzfG7Vkqhfdrg

ChangeLog
libntp/work_thread.c

index dcfa59c07f3fb687e22c57016ce0cd382df674e5..2981eef66e8bc98a852d2dacefd3dadbf4f66ead 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+---
+* [Bug 3456] Use uintptr_t rather than size_t to store an integer in a pointer
+ - According to Brooks Davis, there was only one location <perlinger@ntp.org>
+
 ---
 (4.2.8p11) 2018/02/27 Released by Harlan Stenn <stenn@ntp.org>
 
index 433290c4c9a7ad39aa3dc588b195caf32bd644c3..03a5647bea36b8df2060b8a48c3006fd8bb254ee 100644 (file)
 # define THREAD_MAXSTACKSIZE THREAD_MINSTACKSIZE
 #endif
 
+/* need a good integer to store a pointer... */
+#ifndef UINTPTR_T
+# if defined(UINTPTR_MAX)
+#  define UINTPTR_T uintptr_t
+# elif defined(UINT_PTR)
+#  define UINTPTR_T UINT_PTR
+# else
+#  define UINTPTR_T size_t
+# endif
+#endif
+
 
 #ifdef SYS_WINNT
 
@@ -66,7 +77,7 @@ static BOOL   same_os_sema(const sem_ref obj, void * osobj);
 
 #else
 
-# define thread_exit(c)        pthread_exit((void*)(size_t)(c))
+# define thread_exit(c)        pthread_exit((void*)(UINTPTR_T)(c))
 # define tickle_sem    sem_post
 void *         blocking_thread(void *);
 static void    block_thread_signals(sigset_t *);
@@ -374,7 +385,9 @@ send_blocking_resp_internal(
        if (empty)
        {
 #          ifdef WORK_PIPE
-               write(c->resp_write_pipe, "", 1);
+               if (1 != write(c->resp_write_pipe, "", 1))
+                       msyslog(LOG_WARNING, "async resolver: %s",
+                               "failed to notify main thread!");
 #          else
                tickle_sem(c->responses_pending);
 #          endif