!10 tests: Avoid leaking file descriptors on errors

From: @xinghe_1 
Reviewed-by: @seuzw 
Signed-off-by: @seuzw
This commit is contained in:
openeuler-ci-bot 2022-10-20 07:35:09 +00:00 committed by Gitee
commit 7c42b2e7c6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From 70b465e0bf65c9ac6d1f7e242d2b76a84afaac6a Mon Sep 17 00:00:00 2001
From: Jakub Jelen <jjelen@redhat.com>
Date: Wed, 7 Apr 2021 12:09:59 +0200
Subject: [PATCH] tests: Avoid leaking file descriptors on errors
* tests/fdpassing.c (client): Close fp on error
--
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Conflict: NA
Reference: https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libassuan.git;a=commit;h=70b465e0bf65c9ac6d1f7e242d2b76a84afaac6a
---
tests/fdpassing.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/fdpassing.c b/tests/fdpassing.c
index 3e1b71b..0e23ffc 100644
--- a/tests/fdpassing.c
+++ b/tests/fdpassing.c
@@ -176,6 +176,7 @@ client (assuan_context_t ctx, const char *fname)
rc = assuan_sendfd (ctx, fileno (fp));
if (rc)
{
+ fclose (fp);
log_error ("assuan_sendfd failed: %s\n", gpg_strerror (rc));
return -1;
}
--
2.11.0

View File

@ -1,6 +1,6 @@
Name: libassuan
Version: 2.5.5
Release: 1
Release: 2
Summary: A small library implementing the so-called Assuan protocal
License: LGPLv2+ and GPLv3+
URL: https://www.gnupg.org/
@ -8,6 +8,7 @@ Source0: https://gnupg.org/ftp/gcrypt/libassuan/libassuan-%{version}.tar.b
Source1: https://gnupg.org/ftp/gcrypt/libassuan/libassuan-%{version}.tar.bz2.sig
Patch0: backport-libassuan-2.5.2-multilib.patch
Patch1: backport-tests-Avoid-leaking-file-descriptors-on-errors.patch
BuildRequires: gcc gawk libgpg-error-devel >= 1.8
@ -66,6 +67,12 @@ make check
%doc ChangeLog NEWS README THANKS TODO
%changelog
* Wed Oct 19 2022 xinghe <xinghe2@h-partners.com> - 2.5.5-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: tests: Avoid leaking file descriptors on errors
* Sat Mar 19 2022 xihaochen<xihaochen@h-partners.com> - 2.5.5-1
- Type:requirements
- ID:NA