git: 225612c76d87 - main - dd(1): Preserve const qualifier on bsearch(3) results
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 19 Sep 2026 10:18:32 UTC
The branch main has been updated by kfv:
URL: https://cgit.FreeBSD.org/src/commit/?id=225612c76d870aa6467853fbafcbe34e8296d0d9
commit 225612c76d870aa6467853fbafcbe34e8296d0d9
Author: Faraz Vahedi <kfv@FreeBSD.org>
AuthorDate: 2026-09-19 10:13:20 +0000
Commit: Faraz Vahedi <kfv@FreeBSD.org>
CommitDate: 2026-09-19 10:13:20 +0000
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
---
bin/dd/args.c | 14 +++++++++-----
1 file 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, ",");