From 971a2a6395d1c5fb418f3e2b64ef5213089e6255 Mon Sep 17 00:00:00 2001 From: Nathan Bryant Date: Mon, 11 Mar 2002 04:16:21 +0000 Subject: [PATCH] warning fixes on sparc-sun-solaris2.8 with gcc 3.0.4, mostly for *printf format strings --- citadel/ChangeLog | 5 +++++ citadel/client_crypto.c | 7 ++++++- citadel/serv_crypto.c | 8 ++++++-- citadel/serv_network.c | 4 ++-- citadel/serv_vandelay.c | 4 ++-- citadel/server_main.c | 8 ++++---- citadel/user_ops.c | 8 ++++---- 7 files changed, 29 insertions(+), 15 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index bb92fdac6..42fc5bae3 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,8 @@ $Log$ + Revision 590.136 2002/03/11 04:16:20 nbryant + warning fixes on sparc-sun-solaris2.8 with gcc 3.0.4, mostly for *printf + format strings + Revision 590.135 2002/03/11 03:55:24 nbryant - fixes for building without OpenSSL - setenv doesn't exist on all systems, use putenv instead @@ -3420,3 +3424,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/client_crypto.c b/citadel/client_crypto.c index cede2835a..94daf2fbf 100644 --- a/citadel/client_crypto.c +++ b/citadel/client_crypto.c @@ -128,6 +128,11 @@ void ssl_lock(int mode, int n, const char *file, int line) } #endif /* HAVE_OPENSSL */ +#if defined(THREADED_CLIENT) && defined(HAVE_OPENSSL) +static unsigned long id_callback(void) { + return pthread_self(); +} +#endif /* * starttls() starts SSL/TLS if possible @@ -200,7 +205,7 @@ int starttls(void) #ifdef THREADED_CLIENT /* OpenSSL requires callbacks for threaded clients */ CRYPTO_set_locking_callback(ssl_lock); - CRYPTO_set_id_callback(pthread_self); + CRYPTO_set_id_callback(id_callback); /* OpenSSL requires us to do semaphores for threaded clients */ Critters = malloc(CRYPTO_num_locks() * sizeof (pthread_mutex_t *)); diff --git a/citadel/serv_crypto.c b/citadel/serv_crypto.c index 317457de8..05f84dba2 100644 --- a/citadel/serv_crypto.c +++ b/citadel/serv_crypto.c @@ -1,5 +1,6 @@ /* $Id$ */ +#include #include #include #include "sysdep.h" @@ -40,6 +41,9 @@ SSL_CTX *ssl_ctx; /* SSL context */ pthread_mutex_t **SSLCritters; /* Things needing locking */ +static unsigned long id_callback(void) { + return pthread_self(); +} void init_ssl(void) { @@ -93,7 +97,7 @@ void init_ssl(void) #endif #endif CRYPTO_set_locking_callback(ssl_lock); - CRYPTO_set_id_callback(pthread_self); + CRYPTO_set_id_callback(id_callback); /* Load DH parameters into the context */ dh = DH_new(); @@ -300,7 +304,7 @@ void cmd_gtls(char *params) */ void endtls(void) { - lprintf(7, "Ending SSL/TLS%s\n"); + lprintf(7, "Ending SSL/TLS\n"); if (!CC->ssl) { CC->redirect_ssl = 0; diff --git a/citadel/serv_network.c b/citadel/serv_network.c index 02dc5e235..e8c525615 100644 --- a/citadel/serv_network.c +++ b/citadel/serv_network.c @@ -718,8 +718,8 @@ void network_bounce(struct CtdlMessage *msg, char *reason) { if (msg->cm_fields['I'] != NULL) { phree(msg->cm_fields['I']); } - sprintf(buf, "%ld.%04x.%04x@%s", - (long)time(NULL), getpid(), ++serialnum, config.c_fqdn); + sprintf(buf, "%ld.%04lx.%04x@%s", + (long)time(NULL), (long)getpid(), ++serialnum, config.c_fqdn); msg->cm_fields['I'] = strdoop(buf); /* diff --git a/citadel/serv_vandelay.c b/citadel/serv_vandelay.c index fee34851a..469612eaf 100644 --- a/citadel/serv_vandelay.c +++ b/citadel/serv_vandelay.c @@ -53,7 +53,7 @@ FILE *artv_global_message_list; void artv_export_users_backend(struct usersupp *usbuf, void *data) { cprintf("user\n"); cprintf("%d\n", usbuf->version); - cprintf("%d\n", usbuf->uid); + cprintf("%ld\n", (long)usbuf->uid); cprintf("%s\n", usbuf->password); cprintf("%u\n", usbuf->flags); cprintf("%ld\n", usbuf->timescalled); @@ -256,7 +256,7 @@ void artv_do_export(void) { cprintf("%s\n", config.c_fqdn); cprintf("%s\n", config.c_humannode); cprintf("%s\n", config.c_phonenum); - cprintf("%d\n", config.c_bbsuid); + cprintf("%ld\n", (long)config.c_bbsuid); cprintf("%d\n", config.c_creataide); cprintf("%d\n", config.c_sleeping); cprintf("%d\n", config.c_initax); diff --git a/citadel/server_main.c b/citadel/server_main.c index d5a6a8eba..bc330df66 100644 --- a/citadel/server_main.c +++ b/citadel/server_main.c @@ -195,16 +195,16 @@ int main(int argc, char **argv) */ if (drop_root_perms) { if ((pw = getpwuid(BBSUID)) == NULL) - lprintf(1, "WARNING: getpwuid(%d): %s\n" - "Group IDs will be incorrect.\n", BBSUID, + lprintf(1, "WARNING: getpwuid(%ld): %s\n" + "Group IDs will be incorrect.\n", (long)BBSUID, strerror(errno)); else { initgroups(pw->pw_name, pw->pw_gid); if (setgid(pw->pw_gid)) - lprintf(3, "setgid(%d): %s\n", pw->pw_gid, + lprintf(3, "setgid(%ld): %s\n", (long)pw->pw_gid, strerror(errno)); } - lprintf(7, "Changing uid to %d\n", BBSUID); + lprintf(7, "Changing uid to %ld\n", (long)BBSUID); if (setuid(BBSUID) != 0) { lprintf(3, "setuid() failed: %s\n", strerror(errno)); } diff --git a/citadel/user_ops.c b/citadel/user_ops.c index cf355cba4..836fce4fc 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -479,13 +479,13 @@ static int validpw(uid_t uid, const char *pass) if (pipe(pipev)) { lprintf(1, "pipe failed (%s): denying autologin access for " - "uid %u\n", strerror(errno), uid); + "uid %ld\n", strerror(errno), (long)uid); return 0; } switch (pid = fork()) { case -1: lprintf(1, "fork failed (%s): denying autologin access for " - "uid %u\n", strerror(errno), uid); + "uid %ld\n", strerror(errno), (long)uid); close(pipev[0]); close(pipev[1]); return 0; @@ -512,8 +512,8 @@ static int validpw(uid_t uid, const char *pass) while (waitpid(pid, &status, 0) == -1) if (errno != EINTR) { lprintf(1, "waitpid failed (%s): denying autologin " - "access for uid %u\n", - strerror(errno), uid); + "access for uid %ld\n", + strerror(errno), (long)uid); return 0; } if (WIFEXITED(status) && !WEXITSTATUS(status)) -- 2.30.2