diff --git a/Fix-the-issue-of-ignoring-the-return-value.patch b/Fix-the-issue-of-ignoring-the-return-value.patch new file mode 100644 index 0000000000000000000000000000000000000000..012bea7d4f415b2f6c7d59daac6bcd5d47816905 --- /dev/null +++ b/Fix-the-issue-of-ignoring-the-return-value.patch @@ -0,0 +1,86 @@ +From 4c39cb09735a494099fba0474d25ff26800de952 Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Wed, 29 Jan 2020 12:47:16 -0800 +Subject: [PATCH] Do not ignore write() return value. + +Some distros set the warn_unused_result attribute for the write() +system call, so check the return value. +--- + pki.c | 37 ++++++++++++++++++++++++++++++++----- + 1 file changed, 32 insertions(+), 5 deletions(-) + +diff --git a/pki.c b/pki.c +index 486d9bb..57ea664 100644 +--- a/pki.c ++++ b/pki.c +@@ -9,12 +9,13 @@ + #include + #include + #include "config.h" ++#include ++#include + #ifdef WITH_SECURITY + #include + #include + #include + #endif +-#include + #include + #include "security.h" + #include +@@ -431,17 +432,43 @@ isns_dsa_load_params(const char *filename) + return dsa; + } + ++/* ++ * write one 'status' character to stdout ++ */ ++static void ++write_status_byte(int ch) ++{ ++ static int stdout_fd = 1; /* fileno(stdout) */ ++ char buf[2]; ++ int res; ++ ++ /* ++ * We don't actually care about the return value here, since ++ * we are just dumping a status byte to stdout, but ++ * some linux distrubutions set the warn_unused_result attribute ++ * for the write() API, so we might as well use the return value ++ * to make sure the write command isn't broken. ++ */ ++ assert(ch); ++ buf[0] = ch; ++ buf[1] = '\0'; ++ res = write(stdout_fd, buf, 1); ++ assert(res == 1); ++} ++ + static int + isns_dsa_param_gen_callback(int stage, + __attribute__((unused))int index, + __attribute__((unused))void *dummy) + { + if (stage == 0) +- write(1, "+", 1); ++ write_status_byte('+'); + else if (stage == 1) +- write(1, ".", 1); ++ write_status_byte('.'); + else if (stage == 2) +- write(1, "/", 1); ++ write_status_byte('/'); ++ ++ /* as a callback, we must return a value, so just return success */ + return 0; + } + +@@ -478,7 +505,7 @@ isns_dsa_init_params(const char *filename) + dsa = DSA_generate_parameters(dsa_key_bits, NULL, 0, + NULL, NULL, isns_dsa_param_gen_callback, NULL); + #endif +- write(1, "\n", 1); ++ write_status_byte('\n'); + + if (dsa == NULL) { + isns_dsasig_report_errors("Error generating DSA parameters", diff --git a/open-isns-0.100.tar.gz b/open-isns-0.100.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..64f93457c1ed57e3ec35c0a5dd6c8540f51577d1 Binary files /dev/null and b/open-isns-0.100.tar.gz differ diff --git a/open-isns-0.97.tar.gz b/open-isns-0.97.tar.gz deleted file mode 100644 index 3cfd90e5be8c92838253b8d490d0153c6f224d3d..0000000000000000000000000000000000000000 Binary files a/open-isns-0.97.tar.gz and /dev/null differ diff --git a/open-isns.spec b/open-isns.spec index d222fb9570ded5671da2d46ef79a3aac0a0959af..74d4999d76b2b0881b0db8b56645ae1f64f20179 100644 --- a/open-isns.spec +++ b/open-isns.spec @@ -1,11 +1,11 @@ Name: open-isns -Version: 0.97 -Release: 12 +Version: 0.100 +Release: 1 Summary: The iSNS server and client programs License: LGPLv2+ URL: https://www.github.com/open-iscsi/open-isns Source0: https://www.github.com/open-iscsi/open-isns/archive/v%{version}.tar.gz#/open-isns-%{version}.tar.gz - +Patch0001: Fix-the-issue-of-ignoring-the-return-value.patch BuildRequires: gcc git systemd automake autoconf make BuildRequires: openssl-devel systemd-devel Requires(post): systemd-units @@ -89,6 +89,9 @@ install -p -m 644 isnsd.service %{buildroot}%{_unitdir}/isnsd.service %{_mandir}/man8/* %changelog +* Mon Jun 1 2020 yanan li - 0.100-1 +- Package update + * Fri Jan 17 2020 openEuler Buildteam - 0.97-12 - Type:enhancement - ID:NA