fcrypt: minor improvement in shredTemporaryFile ()
Prevent writing to corrupted files.
See feedback from .
@@ -102,7 +102,6 @@ error:
*/
static int shredTemporaryFile (int fd, Key * errorKey)
{
- kdb_octet_t error = 0;
kdb_octet_t buffer[512] = { 0 };
struct stat tmpStat;
@@ -120,16 +119,10 @@ static int shredTemporaryFile (int fd, Key * errorKey)
for (off_t i = 0; i < tmpStat.st_size; i += sizeof (buffer))
{
if (write (fd, buffer, sizeof (buffer)) != sizeof (buffer))
- {
- // save the error state but keep on writing in the hope that further writes wont't fail
- error = 1;
- }
- }
- if (error)
{
goto error;
}
-
+ }
return 1;
error:
