Thanks so much!  This is my first patch for OpenBSD, and I don't quite have
the workflow debugged yet.

Adam


On Thu, Jan 7, 2021 at 11:29 PM Theo Buehler <t...@theobuehler.org> wrote:

> On Thu, Jan 07, 2021 at 11:16:16PM +0000, Adam Barth wrote:
> > 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.
>
> Thanks. Unfortunately the patch was mangled by your MUA (line wrapping
> and expanded tabs).
>
> Below is a version that applies.
>
> ok tb
>
> Index: lib/libc/gen/fts.c
> ===================================================================
> RCS file: /cvs/src/lib/libc/gen/fts.c,v
> retrieving revision 1.59
> diff -u -p -r1.59 fts.c
> --- lib/libc/gen/fts.c  28 Jun 2019 13:32:41 -0000      1.59
> +++ lib/libc/gen/fts.c  7 Jan 2021 23:23:27 -0000
> @@ -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 nite
>  }
>
>  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;
>

Reply via email to