mirror of
https://github.com/netbirdio/FreeBSD-ports.git
synced 2026-05-22 18:42:42 -07:00
Add patch to fix --contents= and --cfile= handling in sg_wr_mode Patch source: https://github.com/hreinecke/sg3_utils/commits/c27880048df5269e1cf6a32291505f86d7a8dcc1
29 lines
1.1 KiB
C
29 lines
1.1 KiB
C
--- src/sg_wr_mode.c.orig 2023-06-24 02:05:48 UTC
|
|
+++ src/sg_wr_mode.c
|
|
@@ -374,17 +374,23 @@ main(int argc, char * argv[])
|
|
}
|
|
}
|
|
if (cfile_arg || contents_arg) {
|
|
+ const char * inp = (cfile_arg ? cfile_arg : contents_arg);
|
|
+
|
|
if (cfile_arg && contents_arg) {
|
|
pr2serr("Cannot have both --contents= and --cfile= options\n");
|
|
return SG_LIB_SYNTAX_ERROR;
|
|
}
|
|
memset(read_in, 0, read_in_sz);
|
|
- if ((ret = build_mode_page(optarg, !! cfile_arg, do_raw, read_in,
|
|
- &read_in_len, read_in_sz))) {
|
|
+ if ((ret = build_mode_page(inp, !! cfile_arg, do_raw,
|
|
+ read_in, &read_in_len, read_in_sz))) {
|
|
pr2serr("bad argument to '%s'\n", cfile_arg ? "--cfile=" :
|
|
"--contents=");
|
|
return ret;
|
|
}
|
|
+ if (verbose > 5) {
|
|
+ pr2serr("Decoded contents:\n");
|
|
+ hex2stderr(read_in, read_in_len, 1);
|
|
+ }
|
|
got_contents = true;
|
|
}
|
|
|