commit ab809a224b7aee0e7311ab30a343ea4a78e847b8 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:17:15 2019 -0400 Package init diff --git a/0000-smp_utils-0.98-sysmacros.patch b/0000-smp_utils-0.98-sysmacros.patch new file mode 100644 index 0000000..27591e3 --- /dev/null +++ b/0000-smp_utils-0.98-sysmacros.patch @@ -0,0 +1,36 @@ +diff --git a/lib/smp_aac_io.c b/lib/smp_aac_io.c +index 110d0cc..ef91f71 100644 +--- a/lib/smp_aac_io.c ++++ b/lib/smp_aac_io.c +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/lib/smp_lin_bsg.c b/lib/smp_lin_bsg.c +index 0995ded..e19a166 100644 +--- a/lib/smp_lin_bsg.c ++++ b/lib/smp_lin_bsg.c +@@ -40,6 +40,7 @@ + #include + //#include + #include ++#include + #include + #include + #include +diff --git a/lib/smp_mptctl_io.c b/lib/smp_mptctl_io.c +index 5512913..def386d 100644 +--- a/lib/smp_mptctl_io.c ++++ b/lib/smp_mptctl_io.c +@@ -15,6 +15,7 @@ + #include + //#include + #include ++#include + #include + #include + #include diff --git a/6000-Add-files-via-upload.patch b/6000-Add-files-via-upload.patch new file mode 100644 index 0000000..f9431ca --- /dev/null +++ b/6000-Add-files-via-upload.patch @@ -0,0 +1,80 @@ +From 8e7ca311f55fe2074e5b02a17249c5a707edeb3c Mon Sep 17 00:00:00 2001 +From: doug-gilbert <32302704+doug-gilbert@users.noreply.github.com> +Date: Wed, 28 Feb 2018 11:49:45 -0500 +Subject: [PATCH 12/13] Add files via upload + +smp_conf_phy_event: fix file pointer leak; +--- +diff --git a/src/smp_conf_phy_event.c b/src/smp_conf_phy_event.c +index b2ad100..70ce4f5 100644 +--- a/src/smp_conf_phy_event.c ++++ b/src/smp_conf_phy_event.c +@@ -336,6 +336,7 @@ build_joint_arr(const char * file_name, unsigned char * pes_arr, + char line[512]; + int off = 0; + int in_len, k, j, m, have_stdin, ind, bit0, err; ++ int ret = 0; + char * lcp; + FILE * fp; + unsigned int unum; +@@ -376,7 +377,8 @@ build_joint_arr(const char * file_name, unsigned char * pes_arr, + if ((k < in_len) && ('#' != lcp[k])) { + fprintf(stderr, "build_joint_arr: syntax error at " + "line %d, pos %d\n", j + 1, m + k + 1); +- return 1; ++ ret = 1; ++ goto fini; + } + for (k = 0; k < 1024; ++k) { + unum = get_unum(lcp, &err); +@@ -386,7 +388,8 @@ build_joint_arr(const char * file_name, unsigned char * pes_arr, + if (ind >= max_arr_len) { + fprintf(stderr, "build_joint_arr: array length " + "exceeded\n"); +- return 1; ++ ret = 1; ++ goto fini; + } + if (bit0) + thres_arr[ind] = unum; +@@ -394,7 +397,8 @@ build_joint_arr(const char * file_name, unsigned char * pes_arr, + if (unum > 255) { + fprintf(stderr, "build_joint_arr: pes (%u) too " + "large\n", unum); +- return 1; ++ ret = 1; ++ goto fini; + } + pes_arr[ind] = (unsigned char)unum; + } +@@ -412,7 +416,8 @@ build_joint_arr(const char * file_name, unsigned char * pes_arr, + fprintf(stderr, "build_joint_arr: error in " + "line %d, at pos %d\n", j + 1, + (int)(lcp - line + 1)); +- return 1; ++ ret = 1; ++ goto fini; + } + } + off += (k + 1); +@@ -420,10 +425,14 @@ build_joint_arr(const char * file_name, unsigned char * pes_arr, + if (0x1 & off) { + fprintf(stderr, "build_joint_arr: expect LBA,NUM pairs but decoded " + "odd number\n from %s\n", have_stdin ? "stdin" : file_name); +- return 1; ++ ret = 1; ++ goto fini; + } + *arr_len = off >> 1; +- return 0; ++fini: ++ if (! have_stdin) ++ fclose(fp); ++ return ret; + } + + static void + +-- +2.19.1 + diff --git a/smp_utils-0.98.tgz b/smp_utils-0.98.tgz new file mode 100644 index 0000000..e83faa1 Binary files /dev/null and b/smp_utils-0.98.tgz differ diff --git a/smp_utils.spec b/smp_utils.spec new file mode 100644 index 0000000..21d6953 --- /dev/null +++ b/smp_utils.spec @@ -0,0 +1,78 @@ +Name: smp_utils +Version: 0.98 +Release: 14 +Summary: Utilities for SAS management protocol (SMP) +License: BSD +URL: http://sg.danny.cz/sg/smp_utils.html +Source0: http://sg.danny.cz/sg/p/%{name}-%{version}.tgz +Patch0000: 0000-smp_utils-0.98-sysmacros.patch +Patch6000: 6000-Add-files-via-upload.patch + +BuildRequires: gcc,git +Provides: %{name}-libs %{name}-libs%{?_isa} +Obsoletes: %{name}-libs + +%description +The smp_utils package contains utilities for the Serial Attached +SCSI (SAS) Serial Management Protocol (SMP). Most utilities correspond +to a single SMP function, sending out a request, checking for errors +and if all is well processing the response. The response is either +decoded, printed out in ASCII hexadecimal or sent as binary to stdout. +This package supports the linux 2.4 and 2.6 series and should be +easy to port to other operating systems. + +Warning: These utilities access SAS expanders (storage switches) and +the incorrect usage of them may render your system and others inoperable. + + +%package devel +Summary: Static library and header files for the smputils library +Requires: %{name} = %{version}-%{release} + +%description devel +The smp_utils-devel package contains the %{name} library and its header files for +developing applications. + +%package help +Summary: Help info for %{name} +Requires: man + +%description help +This package contains the help info for %{name}. + +%prep +%autosetup -n %{name}-%{version} -p1 -Sgit + +%build +%configure --disable-static + +sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool + +make %{?smp_mflags} CFLAGS="%{optflags} -DSMP_UTILS_LINUX" + + +%install +make install \ + PREFIX=%{_prefix} \ + DESTDIR=%{buildroot} + + +%files +%doc ChangeLog COVERAGE CREDITS README +%license COPYING +%{_bindir}/* +%{_libdir}/*.so.* +%exclude %{_libdir}/*.la + +%files devel +%{_includedir}/scsi/*.h +%{_libdir}/*.so + +%files help +%{_mandir}/man8/* + + +%changelog +* Fri Aug 30 2019 mingfangsen -0.98-13.2 +- Package init