From a3be97df4ddfce008dcc6e877e9fb98c71656ec6 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Mon, 10 Jul 2023 11:18:08 +0900 Subject: common:w32: Fix gnupg_w32_set_errno. * common/sysutils.c (gnupg_w32_set_errno): Return EC. -- Cherry-pick master commit of: 4c6b759368bcf19a13df07c5c6080765ecac28ca Signed-off-by: NIIBE Yutaka --- common/sysutils.c | 1 + 1 file changed, 1 insertion(+) (limited to 'common/sysutils.c') diff --git a/common/sysutils.c b/common/sysutils.c index f8e6d86fc..c88c02d36 100644 --- a/common/sysutils.c +++ b/common/sysutils.c @@ -337,6 +337,7 @@ gnupg_w32_set_errno (int ec) if (ec == -1) ec = GetLastError (); _set_errno (map_w32_to_errno (ec)); + return ec; } #endif /*HAVE_W32_SYSTEM*/ -- cgit v1.2.3 From 7f9e05d73f2ca1ecde1b7ba406d139a19d007998 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 7 Sep 2023 17:21:05 +0200 Subject: common: Never remove /dev/null. * common/sysutils.c (gnupg_remove): Detect /dev/null. -- GnuPG-bug-id: 6556 --- common/sysutils.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'common/sysutils.c') diff --git a/common/sysutils.c b/common/sysutils.c index c88c02d36..90627b7c8 100644 --- a/common/sysutils.c +++ b/common/sysutils.c @@ -810,7 +810,12 @@ gnupg_remove (const char *fname) return -1; return 0; #else - return remove (fname); + /* It is common to use /dev/null for testing. We better don't + * remove that file. */ + if (fname && !strcmp (fname, "/dev/null")) + return 0; + else + return remove (fname); #endif } -- cgit v1.2.3