Fix broken return from _krb5_erase_file on missing file.

The return of lstat should be handled like the "open" if errno = ENOENT.
This commit is contained in:
Ake Sandgren
2019-01-09 11:08:58 +01:00
committed by Nico Williams
parent 717a399bbd
commit 907b9ee6c4

View File

@@ -254,8 +254,12 @@ _krb5_erase_file(krb5_context context, const char *filename)
int ret;
ret = lstat (filename, &sb1);
if (ret < 0)
if (ret < 0) {
if(errno == ENOENT)
return 0;
else
return errno;
}
fd = open(filename, O_RDWR | O_BINARY | O_CLOEXEC | O_NOFOLLOW);
if(fd < 0) {