summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-03-19 00:30:11 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-03-19 00:30:11 +0000
commit5643391d32d8965e97def2dc4d0e58bb24060bc0 (patch)
treeb20a3fb1d2e6123a59938792d862e7b5c5ef5e59 /lib/libc
parent8aee2c24aa2e8e4e5f36756d400b1fa2a0499ab3 (diff)
some -Wall
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/db/btree/bt_delete.c6
-rw-r--r--lib/libc/db/btree/bt_put.c5
-rw-r--r--lib/libc/db/hash/hash.c4
-rw-r--r--lib/libc/db/hash/hash_bigkey.c7
-rw-r--r--lib/libc/db/recno/rec_close.c6
-rw-r--r--lib/libc/gen/fnmatch.c8
-rw-r--r--lib/libc/gen/fts.c14
-rw-r--r--lib/libc/gen/getcap.c6
-rw-r--r--lib/libc/gen/syslog.c5
-rw-r--r--lib/libc/net/rcmd.c5
-rw-r--r--lib/libc/net/res_debug.c7
-rw-r--r--lib/libc/net/res_send.c8
-rw-r--r--lib/libc/regex/regerror.c36
13 files changed, 61 insertions, 56 deletions
diff --git a/lib/libc/db/btree/bt_delete.c b/lib/libc/db/btree/bt_delete.c
index d97a9947d7e..cc8c175d5fe 100644
--- a/lib/libc/db/btree/bt_delete.c
+++ b/lib/libc/db/btree/bt_delete.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_delete.c,v 1.3 1996/08/19 08:20:05 tholo Exp $";
+static char rcsid[] = "$OpenBSD: bt_delete.c,v 1.4 1998/03/19 00:29:51 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -418,7 +418,7 @@ __bt_pdelete(t, h)
* root page. If it's the rootpage, turn it back into an empty
* leaf page.
*/
- if (NEXTINDEX(pg) == 1)
+ if (NEXTINDEX(pg) == 1) {
if (pg->pgno == P_ROOT) {
pg->lower = BTDATAOFF;
pg->upper = t->bt_psize;
@@ -428,7 +428,7 @@ __bt_pdelete(t, h)
return (RET_ERROR);
continue;
}
- else {
+ } else {
/* Pack remaining key items at the end of the page. */
nksize = NBINTERNAL(bi->ksize);
from = (char *)pg + pg->upper;
diff --git a/lib/libc/db/btree/bt_put.c b/lib/libc/db/btree/bt_put.c
index 6615bd79196..3304ccdb5c5 100644
--- a/lib/libc/db/btree/bt_put.c
+++ b/lib/libc/db/btree/bt_put.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_put.c,v 1.4 1997/07/23 21:00:26 kstailey Exp $";
+static char rcsid[] = "$OpenBSD: bt_put.c,v 1.5 1998/03/19 00:29:53 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -223,7 +223,7 @@ delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) {
t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= index)
++t->bt_cursor.pg.index;
- if (t->bt_order == NOT)
+ if (t->bt_order == NOT) {
if (h->nextpg == P_INVALID) {
if (index == NEXTINDEX(h) - 1) {
t->bt_order = FORWARD;
@@ -237,6 +237,7 @@ delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) {
t->bt_last.pgno = h->pgno;
}
}
+ }
mpool_put(t->bt_mp, h, MPOOL_DIRTY);
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c
index 05653547a25..8b1140b9af3 100644
--- a/lib/libc/db/hash/hash.c
+++ b/lib/libc/db/hash/hash.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: hash.c,v 1.5 1997/07/23 21:00:27 kstailey Exp $";
+static char rcsid[] = "$OpenBSD: hash.c,v 1.6 1998/03/19 00:29:55 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -869,7 +869,7 @@ hash_realloc(p_ptr, oldsize, newsize)
{
register void *p;
- if (p = malloc(newsize)) {
+ if ((p = malloc(newsize))) {
memmove(p, *p_ptr, oldsize);
memset((char *)p + oldsize, 0, newsize - oldsize);
free(*p_ptr);
diff --git a/lib/libc/db/hash/hash_bigkey.c b/lib/libc/db/hash/hash_bigkey.c
index 766948a1b11..7e51158980c 100644
--- a/lib/libc/db/hash/hash_bigkey.c
+++ b/lib/libc/db/hash/hash_bigkey.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: hash_bigkey.c,v 1.4 1996/09/15 09:30:48 tholo Exp $";
+static char rcsid[] = "$OpenBSD: hash_bigkey.c,v 1.5 1998/03/19 00:29:56 millert Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -121,7 +121,7 @@ __big_insert(hashp, bufp, key, val)
if (!bufp)
return (-1);
n = p[0];
- if (!key_size)
+ if (!key_size) {
if (FREESPACE(p)) {
move_bytes = MIN(FREESPACE(p), val_size);
off = OFFSET(p) - move_bytes;
@@ -134,6 +134,7 @@ __big_insert(hashp, bufp, key, val)
OFFSET(p) = off;
} else
p[n - 2] = FULL_KEY;
+ }
p = (u_int16_t *)bufp->page;
cp = bufp->page;
bufp->flags |= BUF_MOD;
@@ -590,7 +591,7 @@ __big_split(hashp, op, np, big_keyp, addr, obucket, ret)
return (-1);
change = (__call_hash(hashp, key.data, key.size) != obucket);
- if (ret->next_addr = __find_last_page(hashp, &big_keyp)) {
+ if ((ret->next_addr = __find_last_page(hashp, &big_keyp))) {
if (!(ret->nextp =
__get_buf(hashp, ret->next_addr, big_keyp, 0)))
return (-1);;
diff --git a/lib/libc/db/recno/rec_close.c b/lib/libc/db/recno/rec_close.c
index 9c64ddc9964..88aea2e7583 100644
--- a/lib/libc/db/recno/rec_close.c
+++ b/lib/libc/db/recno/rec_close.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: rec_close.c,v 1.4 1996/09/15 09:30:53 tholo Exp $";
+static char rcsid[] = "$OpenBSD: rec_close.c,v 1.5 1998/03/19 00:29:58 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -79,14 +79,14 @@ __rec_close(dbp)
if (F_ISSET(t, R_MEMMAPPED) && munmap(t->bt_smap, t->bt_msize))
status = RET_ERROR;
- if (!F_ISSET(t, R_INMEM))
+ if (!F_ISSET(t, R_INMEM)) {
if (F_ISSET(t, R_CLOSEFP)) {
if (fclose(t->bt_rfp))
status = RET_ERROR;
} else
if (close(t->bt_rfd))
status = RET_ERROR;
-
+ }
if (__bt_close(dbp) == RET_ERROR)
status = RET_ERROR;
diff --git a/lib/libc/gen/fnmatch.c b/lib/libc/gen/fnmatch.c
index 5063ff36a44..acb6047b7fd 100644
--- a/lib/libc/gen/fnmatch.c
+++ b/lib/libc/gen/fnmatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fnmatch.c,v 1.5 1997/09/22 05:03:30 millert Exp $ */
+/* $OpenBSD: fnmatch.c,v 1.6 1998/03/19 00:29:59 millert Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94";
#else
-static char rcsid[] = "$OpenBSD: fnmatch.c,v 1.5 1997/09/22 05:03:30 millert Exp $";
+static char rcsid[] = "$OpenBSD: fnmatch.c,v 1.6 1998/03/19 00:29:59 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -100,14 +100,14 @@ fnmatch(pattern, string, flags)
return (FNM_NOMATCH);
/* Optimize for pattern with * at end or before /. */
- if (c == EOS)
+ if (c == EOS) {
if (flags & FNM_PATHNAME)
return ((flags & FNM_LEADING_DIR) ||
strchr(string, '/') == NULL ?
0 : FNM_NOMATCH);
else
return (0);
- else if (c == '/' && (flags & FNM_PATHNAME)) {
+ } else if (c == '/' && (flags & FNM_PATHNAME)) {
if ((string = strchr(string, '/')) == NULL)
return (FNM_NOMATCH);
break;
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index 161853fc24c..f221f986959 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fts.c,v 1.14 1997/10/11 04:04:40 millert Exp $ */
+/* $OpenBSD: fts.c,v 1.15 1998/03/19 00:30:01 millert Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
#else
-static char rcsid[] = "$OpenBSD: fts.c,v 1.14 1997/10/11 04:04:40 millert Exp $";
+static char rcsid[] = "$OpenBSD: fts.c,v 1.15 1998/03/19 00:30:01 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -299,12 +299,13 @@ fts_read(sp)
if (instr == FTS_FOLLOW &&
(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
p->fts_info = fts_stat(sp, p, 1);
- if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
+ if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
p->fts_errno = errno;
p->fts_info = FTS_ERR;
} else
p->fts_flags |= FTS_SYMFOLLOW;
+ }
return (p);
}
@@ -394,13 +395,14 @@ next: tmp = p;
goto next;
if (p->fts_instr == FTS_FOLLOW) {
p->fts_info = fts_stat(sp, p, 1);
- if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
+ if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
if ((p->fts_symfd =
open(".", O_RDONLY, 0)) < 0) {
p->fts_errno = errno;
p->fts_info = FTS_ERR;
} else
p->fts_flags |= FTS_SYMFOLLOW;
+ }
p->fts_instr = FTS_NOINSTR;
}
@@ -641,7 +643,7 @@ fts_build(sp, type)
* checking FTS_NS on the returned nodes.
*/
cderrno = 0;
- if (nlinks || type == BREAD)
+ if (nlinks || type == BREAD) {
if (fts_safe_changedir(sp, cur, dirfd(dirp))) {
if (nlinks && type == BREAD)
cur->fts_errno = errno;
@@ -652,7 +654,7 @@ fts_build(sp, type)
dirp = NULL;
} else
descend = 1;
- else
+ } else
descend = 0;
/*
diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c
index 98e7c14acef..75013d7c3f9 100644
--- a/lib/libc/gen/getcap.c
+++ b/lib/libc/gen/getcap.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: getcap.c,v 1.12 1998/03/17 23:28:58 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: getcap.c,v 1.13 1998/03/19 00:30:02 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -593,12 +593,12 @@ cgetmatch(buf, name)
*/
np = name;
for (;;)
- if (*np == '\0')
+ if (*np == '\0') {
if (*bp == '|' || *bp == ':' || *bp == '\0')
return (0);
else
break;
- else
+ } else
if (*bp++ != *np++)
break;
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index c6e3e34b1b2..d1bb6af360e 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: syslog.c,v 1.7 1998/03/06 02:01:38 brian Exp $";
+static char rcsid[] = "$OpenBSD: syslog.c,v 1.8 1998/03/19 00:30:03 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -262,13 +262,14 @@ openlog(ident, logstat, logfac)
(void)fcntl(LogFile, F_SETFD, 1);
}
}
- if (LogFile != -1 && !connected)
+ if (LogFile != -1 && !connected) {
if (connect(LogFile, (struct sockaddr *)&SyslogAddr,
sizeof(SyslogAddr)) == -1) {
(void)close(LogFile);
LogFile = -1;
} else
connected = 1;
+ }
}
void
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index ad701acf0e9..c933f5b4475 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: rcmd.c,v 1.30 1998/02/12 02:21:19 deraadt Exp $";
+static char *rcsid = "$OpenBSD: rcmd.c,v 1.31 1998/03/19 00:30:05 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -402,7 +402,6 @@ __ivaliduser(hostf, raddrl, luser, ruser)
const char *luser, *ruser;
{
register char *user, *p;
- int ch;
char *buf;
const char *auser, *ahost;
int hostok, userok;
@@ -427,7 +426,7 @@ __ivaliduser(hostf, raddrl, luser, ruser)
continue;
if (*p == ' ' || *p == '\t') {
*p++ = '\0';
- while (*p == ' ' || *p == '\t' && p < buf + buflen)
+ while ((*p == ' ' || *p == '\t') && p < buf + buflen)
p++;
if (p >= buf + buflen)
continue;
diff --git a/lib/libc/net/res_debug.c b/lib/libc/net/res_debug.c
index 908ad421b7b..c2725395a04 100644
--- a/lib/libc/net/res_debug.c
+++ b/lib/libc/net/res_debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_debug.c,v 1.8 1997/07/09 01:08:51 millert Exp $ */
+/* $OpenBSD: res_debug.c,v 1.9 1998/03/19 00:30:06 millert Exp $ */
/*
* ++Copyright++ 1985, 1990, 1993
@@ -82,7 +82,7 @@
static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$From: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: res_debug.c,v 1.8 1997/07/09 01:08:51 millert Exp $";
+static char rcsid[] = "$OpenBSD: res_debug.c,v 1.9 1998/03/19 00:30:06 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -437,11 +437,12 @@ __p_fqnname(cp, msg, msglen, name, namelen)
if ((n = dn_expand(msg, cp + msglen, cp, name, namelen)) < 0)
return (NULL);
newlen = strlen (name);
- if (newlen == 0 || name[newlen - 1] != '.')
+ if (newlen == 0 || name[newlen - 1] != '.') {
if (newlen+1 >= namelen) /* Lack space for final dot */
return (NULL);
else
strcpy(name + newlen, ".");
+ }
return (cp + n);
}
diff --git a/lib/libc/net/res_send.c b/lib/libc/net/res_send.c
index b89398aab3f..0cda3510ebe 100644
--- a/lib/libc/net/res_send.c
+++ b/lib/libc/net/res_send.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_send.c,v 1.7 1997/06/04 03:18:41 dm Exp $ */
+/* $OpenBSD: res_send.c,v 1.8 1998/03/19 00:30:08 millert Exp $ */
/*
* ++Copyright++ 1985, 1989, 1993
@@ -60,7 +60,7 @@
static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$From: res_send.c,v 8.12 1996/10/08 04:51:06 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: res_send.c,v 1.7 1997/06/04 03:18:41 dm Exp $";
+static char rcsid[] = "$OpenBSD: res_send.c,v 1.8 1998/03/19 00:30:08 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -751,12 +751,12 @@ read_len:
} /*foreach ns*/
} /*foreach retry*/
res_close();
- if (!v_circuit)
+ if (!v_circuit) {
if (!gotsomewhere)
errno = ECONNREFUSED; /* no nameservers found */
else
errno = ETIMEDOUT; /* no answer obtained */
- else
+ } else
errno = terrno;
return (-1);
}
diff --git a/lib/libc/regex/regerror.c b/lib/libc/regex/regerror.c
index 3adaa82f7df..23915915a5b 100644
--- a/lib/libc/regex/regerror.c
+++ b/lib/libc/regex/regerror.c
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
#else
-static char rcsid[] = "$OpenBSD: regerror.c,v 1.4 1997/04/28 20:44:59 millert Exp $";
+static char rcsid[] = "$OpenBSD: regerror.c,v 1.5 1998/03/19 00:30:10 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -92,23 +92,23 @@ static struct rerr {
char *name;
char *explain;
} rerrs[] = {
- REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match",
- REG_BADPAT, "REG_BADPAT", "invalid regular expression",
- REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element",
- REG_ECTYPE, "REG_ECTYPE", "invalid character class",
- REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)",
- REG_ESUBREG, "REG_ESUBREG", "invalid backreference number",
- REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced",
- REG_EPAREN, "REG_EPAREN", "parentheses not balanced",
- REG_EBRACE, "REG_EBRACE", "braces not balanced",
- REG_BADBR, "REG_BADBR", "invalid repetition count(s)",
- REG_ERANGE, "REG_ERANGE", "invalid character range",
- REG_ESPACE, "REG_ESPACE", "out of memory",
- REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid",
- REG_EMPTY, "REG_EMPTY", "empty (sub)expression",
- REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug",
- REG_INVARG, "REG_INVARG", "invalid argument to regex routine",
- 0, "", "*** unknown regexp error code ***",
+ { REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match" },
+ { REG_BADPAT, "REG_BADPAT", "invalid regular expression" },
+ { REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" },
+ { REG_ECTYPE, "REG_ECTYPE", "invalid character class" },
+ { REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)" },
+ { REG_ESUBREG, "REG_ESUBREG", "invalid backreference number" },
+ { REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced" },
+ { REG_EPAREN, "REG_EPAREN", "parentheses not balanced" },
+ { REG_EBRACE, "REG_EBRACE", "braces not balanced" },
+ { REG_BADBR, "REG_BADBR", "invalid repetition count(s)" },
+ { REG_ERANGE, "REG_ERANGE", "invalid character range" },
+ { REG_ESPACE, "REG_ESPACE", "out of memory" },
+ { REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid" },
+ { REG_EMPTY, "REG_EMPTY", "empty (sub)expression" },
+ { REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug" },
+ { REG_INVARG, "REG_INVARG", "invalid argument to regex routine" },
+ { 0, "", "*** unknown regexp error code ***" }
};
/*