diff options
| author | Faraz Vahedi <kfv@FreeBSD.org> | 2026-09-19 10:13:20 +0000 |
|---|---|---|
| committer | Faraz Vahedi <kfv@FreeBSD.org> | 2026-09-19 10:13:20 +0000 |
| commit | 225612c76d870aa6467853fbafcbe34e8296d0d9 (patch) | |
| tree | bd5b65f8974eb3d5e42aa3aceadf23accc57b052 | |
| parent | 4680109c6bc425b0a3b76fad57888c239e918615 (diff) | |
dd(1): Preserve const qualifier on bsearch(3) results
Reviewed by: fuz, dteske
Approved by: fuz (mentor), dteske (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D59754
| -rw-r--r-- | bin/dd/args.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/dd/args.c b/bin/dd/args.c index 10bb89e632b0..0ae50c40414c 100644 --- a/bin/dd/args.c +++ b/bin/dd/args.c @@ -103,7 +103,8 @@ static char *oper; void jcl(char **argv) { - struct arg *ap, tmp; + const struct arg *ap; + struct arg tmp; char *arg; in.dbsz = out.dbsz = 512; @@ -117,7 +118,7 @@ jcl(char **argv) if (!*arg) errx(1, "no value specified for %s", oper); tmp.name = oper; - if (!(ap = (struct arg *)bsearch(&tmp, args, + if (!(ap = bsearch(&tmp, args, sizeof(args)/sizeof(struct arg), sizeof(struct arg), c_arg))) errx(1, "unknown operand %s", tmp.name); @@ -265,7 +266,8 @@ static const struct iflag { static void f_iflag(char *arg) { - struct iflag *ip, tmp; + const struct iflag *ip; + struct iflag tmp; while (arg != NULL) { tmp.name = strsep(&arg, ","); @@ -375,7 +377,8 @@ static const struct conv { static void f_conv(char *arg) { - struct conv *cp, tmp; + const struct conv *cp; + struct conv tmp; while (arg != NULL) { tmp.name = strsep(&arg, ","); @@ -411,7 +414,8 @@ static const struct oflag { static void f_oflag(char *arg) { - struct oflag *op, tmp; + const struct oflag *op; + struct oflag tmp; while (arg != NULL) { tmp.name = strsep(&arg, ","); |
