summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-10-27 21:14:11 +0000
committerNick Mathewson <nickm@torproject.org>2004-10-27 21:14:11 +0000
commit2fbf31533ba595c3c0ba6a0c1349208fbdfb498a (patch)
tree226089a8ad38086deea48477c9484a7b72e574b8 /src/common
parentce5709184bef665a545bcbf207598ad0f991a67b (diff)
downloadtor-2fbf31533ba595c3c0ba6a0c1349208fbdfb498a.tar.gz
tor-2fbf31533ba595c3c0ba6a0c1349208fbdfb498a.zip
Tricksy compiler warnings! We hates them, hates them forever, my precious!
svn:r2615
Diffstat (limited to 'src/common')
-rw-r--r--src/common/crypto.c4
-rw-r--r--src/common/log.c6
-rw-r--r--src/common/tortls.c4
3 files changed, 8 insertions, 6 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index b4659078bc..4fe2ae0e85 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -127,7 +127,7 @@ static int _crypto_global_initialized = 0;
static void
crypto_log_errors(int severity, const char *doing)
{
- int err;
+ unsigned int err;
const char *msg, *lib, *func;
while ((err = ERR_get_error()) != 0) {
msg = (const char*)ERR_reason_error_string(err);
@@ -1398,7 +1398,7 @@ int crypto_seed_rng(void)
RAND_screen();
return 0;
#else
- static char *filenames[] = {
+ static const char *filenames[] = {
"/dev/srandom", "/dev/urandom", "/dev/random", NULL
};
int fd;
diff --git a/src/common/log.c b/src/common/log.c
index 7073df18ad..8fbb343a91 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -124,11 +124,13 @@ static INLINE char *format_msg(char *buf, size_t buf_len,
n += r;
}
- n += tor_vsnprintf(buf+n,buf_len-n,format,ap);
- if(n < 0) {
+ r = tor_vsnprintf(buf+n,buf_len-n,format,ap);
+ if(r < 0) {
n = buf_len-2;
strlcpy(buf+buf_len-TRUNCATED_STR_LEN-1, TRUNCATED_STR,
buf_len-(buf_len-TRUNCATED_STR_LEN-1));
+ } else {
+ n += r;
}
buf[n]='\n';
buf[n+1]='\0';
diff --git a/src/common/tortls.c b/src/common/tortls.c
index eaef6468bf..051b9887df 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -210,7 +210,7 @@ tor_tls_create_certificate(crypto_pk_env_t *rsa,
goto error;
if ((nid = OBJ_txt2nid("organizationName")) == NID_undef) goto error;
if (!(X509_NAME_add_entry_by_NID(name, nid, MBSTRING_ASC,
- "TOR", -1, -1, 0))) goto error;
+ (char*)"TOR", -1, -1, 0))) goto error;
if ((nid = OBJ_txt2nid("commonName")) == NID_undef) goto error;
if (!(X509_NAME_add_entry_by_NID(name, nid, MBSTRING_ASC,
(char*)cname, -1, -1, 0))) goto error;
@@ -221,7 +221,7 @@ tor_tls_create_certificate(crypto_pk_env_t *rsa,
goto error;
if ((nid = OBJ_txt2nid("organizationName")) == NID_undef) goto error;
if (!(X509_NAME_add_entry_by_NID(name_issuer, nid, MBSTRING_ASC,
- "TOR", -1, -1, 0))) goto error;
+ (char*)"TOR", -1, -1, 0))) goto error;
if ((nid = OBJ_txt2nid("commonName")) == NID_undef) goto error;
if (!(X509_NAME_add_entry_by_NID(name_issuer, nid, MBSTRING_ASC,
(char*)cname_sign, -1, -1, 0))) goto error;