summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysutils/sg3_utils/Makefile2
-rw-r--r--sysutils/sg3_utils/files/patch-src_sg__wr__mode.c28
2 files changed, 29 insertions, 1 deletions
diff --git a/sysutils/sg3_utils/Makefile b/sysutils/sg3_utils/Makefile
index 0520e6ca68f9..ac9542b2d491 100644
--- a/sysutils/sg3_utils/Makefile
+++ b/sysutils/sg3_utils/Makefile
@@ -1,6 +1,6 @@
PORTNAME= sg3_utils
DISTVERSION= 1.48
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= http://sg.danny.cz/sg/p/
diff --git a/sysutils/sg3_utils/files/patch-src_sg__wr__mode.c b/sysutils/sg3_utils/files/patch-src_sg__wr__mode.c
new file mode 100644
index 000000000000..e9e1c7c2c7cb
--- /dev/null
+++ b/sysutils/sg3_utils/files/patch-src_sg__wr__mode.c
@@ -0,0 +1,28 @@
+--- 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;
+ }
+