Commit 675d858
osdep/linux/ofpath: Update strstr() calls
With C23, strstr() returns a "const char *" if its first argument is
"const char *", and these changes are implemented in glibc-2.43.
As a result, the first strstr() call in check_sas() now returns a "const
char *" instead of "char *" because sysfs_path is a "const char *". This
triggers a "discards qualifiers" warning, that is later promoted to an
error and ultimately causes the build to fail.
To fix the issue, this patch converts "ed", the pointer that stores
strstr()'s return value, to a "const char *". Removes the xstrdup()
call and cleans up the rest of the function by updating the *printf()
calls and using pointer arithmetic to compute lengths instead of strlen().
Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>1 parent 170221b commit 675d858
1 file changed
+12
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
491 | | - | |
492 | | - | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
493 | 496 | | |
494 | 497 | | |
495 | 498 | | |
| |||
498 | 501 | | |
499 | 502 | | |
500 | 503 | | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | 504 | | |
507 | 505 | | |
508 | 506 | | |
509 | | - | |
| 507 | + | |
| 508 | + | |
510 | 509 | | |
511 | | - | |
512 | | - | |
| 510 | + | |
513 | 511 | | |
514 | | - | |
| 512 | + | |
| 513 | + | |
515 | 514 | | |
516 | 515 | | |
517 | 516 | | |
| |||
524 | 523 | | |
525 | 524 | | |
526 | 525 | | |
527 | | - | |
| 526 | + | |
| 527 | + | |
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
| |||
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
538 | | - | |
539 | 538 | | |
540 | 539 | | |
541 | 540 | | |
| |||
0 commit comments