allow secure remove to be able to write multiple times... in theory...
but for now it's once. :) SVN revision: 77147
This commit is contained in:
parent
17ce568685
commit
dfb8541aad
|
@ -1680,6 +1680,9 @@ _e_fm_op_destroy_atom(E_Fm_Op_Task *task)
|
|||
static int fd = -1;
|
||||
static char *buf = NULL;
|
||||
off_t pos, sz;
|
||||
// if we do this 7 times! we're
|
||||
// int cnt, overwrite_count = 7;
|
||||
int cnt, overwrite_count = 1;
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
|
@ -1709,6 +1712,8 @@ _e_fm_op_destroy_atom(E_Fm_Op_Task *task)
|
|||
task->src.st.st_size = st2.st_size;
|
||||
}
|
||||
|
||||
for (cnt = 0; cnt < overwrite_count; cnt++)
|
||||
{
|
||||
if (lseek(fd, SEEK_SET, 0) == -1)
|
||||
goto finish;
|
||||
|
||||
|
@ -1716,7 +1721,9 @@ _e_fm_op_destroy_atom(E_Fm_Op_Task *task)
|
|||
{
|
||||
sz = 65536;
|
||||
if ((task->src.st.st_size - pos) < sz) sz = task->src.st.st_size - pos;
|
||||
if (_e_fm_op_random_buf(buf, sz) == -1) memset(buf, 0xff, sz);
|
||||
if (_e_fm_op_random_buf(buf, sz) == -1)
|
||||
// alternate patterb between 0x00 and 0xff each round starting with 0xff
|
||||
memset(buf, 0xff * ((cnt + 1) & 0x1), sz);
|
||||
if (write(fd, buf, sz) != sz)
|
||||
{
|
||||
fsync(fd);
|
||||
|
@ -1725,6 +1732,7 @@ _e_fm_op_destroy_atom(E_Fm_Op_Task *task)
|
|||
}
|
||||
if (fsync(fd) == -1)
|
||||
goto finish;
|
||||
}
|
||||
|
||||
task->dst.done++;
|
||||
_e_fm_op_update_progress_report_simple((double)task->dst.done/NB_PASS*100, "/dev/urandom", task->src.name);
|
||||
|
|
Loading…
Reference in New Issue