hx509: Fix coverity warnings

This commit is contained in:
Nicolas Williams
2022-01-17 17:36:48 -06:00
parent 2e729a9aa2
commit dd71303a2f
7 changed files with 39 additions and 19 deletions

View File

@@ -350,12 +350,8 @@ _hx509_erase_file(hx509_context context, const char *fn)
fd = open(fn, O_RDWR | O_BINARY | O_CLOEXEC | O_NOFOLLOW);
if (fd < 0)
return errno;
return errno == ENOENT ? 0 : errno;
rk_cloexec(fd);
if (ret == -1 && errno == ENOENT)
return 0;
if (ret == -1)
return errno;
if (unlink(fn) < 0) {
ret = errno;