Package update

This commit is contained in:
lyn1001 2020-06-02 02:12:01 +00:00
parent 7c72244d15
commit 2c6c48e292
4 changed files with 92 additions and 3 deletions

View File

@ -0,0 +1,86 @@
From 4c39cb09735a494099fba0474d25ff26800de952 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
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 <unistd.h>
#include <limits.h>
#include "config.h"
+#include <fcntl.h>
+#include <assert.h>
#ifdef WITH_SECURITY
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#endif
-#include <fcntl.h>
#include <libisns/isns.h>
#include "security.h"
#include <libisns/util.h>
@@ -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",

BIN
open-isns-0.100.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -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 <liyanan032@huawei.com> - 0.100-1
- Package update
* Fri Jan 17 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.97-12
- Type:enhancement
- ID:NA