summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2021-01-08 16:06:30 +0000
committertb <tb@openbsd.org>2021-01-08 16:06:30 +0000
commit8ce2995a34a601a9ef340d68d2e6405dcd9ca268 (patch)
tree77afbf444b1f6ce86146952fc55397a3400d45a4 /lib/libc
parentBump default datasize-max and datasize-cur since clang now seems to (diff)
downloadwireguard-openbsd-8ce2995a34a601a9ef340d68d2e6405dcd9ca268.tar.xz
wireguard-openbsd-8ce2995a34a601a9ef340d68d2e6405dcd9ca268.zip
Make fts_{alloc,safe_changed}() const correct
Previously, this code was passing string constants to functions that did not declare their parameters as const. After this patch, the functions now declare that they do not modify these arguments, making it safe to pass string constants. Fixes -Wincompatible-pointer-types-discards-qualifiers. From Adam Barth <abarth google com> ok millert
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/fts.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index d13d0a3f223..a833892e903 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fts.c,v 1.59 2019/06/28 13:32:41 deraadt Exp $ */
+/* $OpenBSD: fts.c,v 1.60 2021/01/08 16:06:30 tb Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -43,7 +43,7 @@
#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
-static FTSENT *fts_alloc(FTS *, char *, size_t);
+static FTSENT *fts_alloc(FTS *, const char *, size_t);
static FTSENT *fts_build(FTS *, int);
static void fts_lfree(FTSENT *);
static void fts_load(FTS *, FTSENT *);
@@ -52,7 +52,7 @@ static void fts_padjust(FTS *, FTSENT *);
static int fts_palloc(FTS *, size_t);
static FTSENT *fts_sort(FTS *, FTSENT *, int);
static u_short fts_stat(FTS *, FTSENT *, int, int);
-static int fts_safe_changedir(FTS *, FTSENT *, int, char *);
+static int fts_safe_changedir(FTS *, FTSENT *, int, const char *);
#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
@@ -901,7 +901,7 @@ fts_sort(FTS *sp, FTSENT *head, int nitems)
}
static FTSENT *
-fts_alloc(FTS *sp, char *name, size_t namelen)
+fts_alloc(FTS *sp, const char *name, size_t namelen)
{
FTSENT *p;
size_t len;
@@ -1020,7 +1020,7 @@ fts_maxarglen(char * const *argv)
* Assumes p->fts_dev and p->fts_ino are filled in.
*/
static int
-fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path)
+fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const char *path)
{
int ret, oerrno, newfd;
struct stat sb;