aboutsummaryrefslogtreecommitdiffstats
path: root/common/sysutils.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-09-07 15:21:05 +0000
committerWerner Koch <[email protected]>2023-09-07 15:21:05 +0000
commit7f9e05d73f2ca1ecde1b7ba406d139a19d007998 (patch)
tree74045d7623c02cc7c7401a19367a5e6edd8c60af /common/sysutils.c
parentgpg: Fix validity of re-imported keys. (diff)
downloadgnupg-7f9e05d73f2ca1ecde1b7ba406d139a19d007998.tar.gz
gnupg-7f9e05d73f2ca1ecde1b7ba406d139a19d007998.zip
common: Never remove /dev/null.
* common/sysutils.c (gnupg_remove): Detect /dev/null. -- GnuPG-bug-id: 6556
Diffstat (limited to 'common/sysutils.c')
-rw-r--r--common/sysutils.c7
1 files changed, 6 insertions, 1 deletions
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
}