1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-08 08:43:13 +02:00

Get rid of a number of clang warnings.

This commit is contained in:
Bram Matthys
2018-04-22 17:06:31 +02:00
parent f535860670
commit 33db0bf73e
6 changed files with 26 additions and 31 deletions
+5 -1
View File
@@ -1231,7 +1231,11 @@ int InitUnrealIRCd(int argc, char *argv[])
exit(0);
#endif
case 'U':
chdir(CONFDIR);
if (chdir(CONFDIR) < 0)
{
fprintf(stderr, "Unable to change to '%s' directory\n", CONFDIR);
exit(1);
}
update_conf();
exit(0);
case 'R':
+1 -1
View File
@@ -581,7 +581,7 @@ int size_string, ret;
me.name, sptr->name);
return 0;
}
for (; (*ctcp == ' '); ctcp++); /* skip leading spaces */
for (; *ctcp == ' '; ctcp++); /* skip leading spaces */
if (*ctcp == '"' && *(ctcp+1))
end = index(ctcp+1, '"');
+2 -2
View File
@@ -266,7 +266,7 @@ int websocket_handshake_helper(char *buffer, int len, char **key, char **value,
/* First check if the line contains a terminating \n. If not, don't process it
* as it may have been a cut header.
*/
for (p; *p; p++)
for (; *p; p++)
{
if (*p == '\n')
{
@@ -284,7 +284,7 @@ int websocket_handshake_helper(char *buffer, int len, char **key, char **value,
p = k;
for (p; *p; p++)
for (; *p; p++)
{
if ((*p == '\n') || (*p == '\r'))
{
+5 -1
View File
@@ -196,7 +196,11 @@ void debug(int level, char *form, ...)
#ifndef _WIN32
strlcat(debugbuf, "\n", sizeof(debugbuf));
write(debugfd, debugbuf, strlen(debugbuf));
if (write(debugfd, debugbuf, strlen(debugbuf)) < 0)
{
/* Yeah.. what can we do if output isn't working? Outputting an error makes no sense */
;
}
#else
strlcat(debugbuf, "\r\n", sizeof(debugbuf));
OutputDebugString(debugbuf);
+13 -3
View File
@@ -142,7 +142,7 @@ void dcc_wipe_services(void)
for (dconf = conf_deny_dcc; dconf; dconf = next)
{
next = dconf->next;
if ((dconf->flag.type2 == CONF_BAN_TYPE_AKILL))
if (dconf->flag.type2 == CONF_BAN_TYPE_AKILL)
{
DelListItem(dconf, conf_deny_dcc);
if (dconf->filename)
@@ -333,7 +333,13 @@ static char recursion_trap=0;
}
if (logs->logfd != -1)
{
write(logs->logfd, "Max file size reached, starting new log file\n", 45);
if (write(logs->logfd, "Max file size reached, starting new log file\n", 45) < 0)
{
/* We already handle the unable to write to log file case for normal data.
* I think we can get away with not handling this one.
*/
;
}
fd_close(logs->logfd);
}
@@ -370,7 +376,11 @@ static char recursion_trap=0;
/* this shouldn't happen, but lets not waste unnecessary syscalls... */
if (logs->logfd == -1)
continue;
write(logs->logfd, timebuf, strlen(timebuf));
if (write(logs->logfd, timebuf, strlen(timebuf)) < 0)
{
/* Let's ignore any write errors for this one. Next write() will catch it... */
;
}
n = write(logs->logfd, buf, strlen(buf));
if (n == strlen(buf))
{
-23
View File
@@ -140,26 +140,3 @@ void count_scache(int *number_servers_cached, u_long *mem_servers_cached)
}
}
}
/*
* list all server names in scache very verbose
*/
void list_scache(aClient *sptr)
{
int hash_index;
SCACHE *ptr;
for (hash_index = 0; hash_index < SCACHE_HASH_SIZE; hash_index++)
{
ptr = scache_hash[hash_index];
while (ptr)
{
if (ptr->name)
sendto_one(sptr,
":%s NOTICE %s :server=%s hash=%i",
me.name, sptr->name, ptr->name, hash_index);
ptr = ptr->next;
}
}
}