From: Juergen Perlinger Date: Mon, 12 Mar 2018 15:36:51 +0000 (+0100) Subject: [Bug 3456] Use uintptr_t rather than size_t to store an integer in a pointer X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4a3e228c79d26aae009fd5c9b4a989a3ba914bd;p=thirdparty%2Fntp.git [Bug 3456] Use uintptr_t rather than size_t to store an integer in a pointer bk: 5aa69e93pthCwAca3XzfG7Vkqhfdrg --- diff --git a/ChangeLog b/ChangeLog index dcfa59c07..2981eef66 100644 --- 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 + --- (4.2.8p11) 2018/02/27 Released by Harlan Stenn diff --git a/libntp/work_thread.c b/libntp/work_thread.c index 433290c4c..03a5647be 100644 --- a/libntp/work_thread.c +++ b/libntp/work_thread.c @@ -56,6 +56,17 @@ # 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