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 int fd = -1;
|
||||||
static char *buf = NULL;
|
static char *buf = NULL;
|
||||||
off_t pos, sz;
|
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)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
|
@ -1709,22 +1712,27 @@ _e_fm_op_destroy_atom(E_Fm_Op_Task *task)
|
||||||
task->src.st.st_size = st2.st_size;
|
task->src.st.st_size = st2.st_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lseek(fd, SEEK_SET, 0) == -1)
|
for (cnt = 0; cnt < overwrite_count; cnt++)
|
||||||
goto finish;
|
|
||||||
|
|
||||||
for (pos = 0; pos < task->src.st.st_size; pos += 65536)
|
|
||||||
{
|
{
|
||||||
sz = 65536;
|
if (lseek(fd, SEEK_SET, 0) == -1)
|
||||||
if ((task->src.st.st_size - pos) < sz) sz = task->src.st.st_size - pos;
|
goto finish;
|
||||||
if (_e_fm_op_random_buf(buf, sz) == -1) memset(buf, 0xff, sz);
|
|
||||||
if (write(fd, buf, sz) != sz)
|
for (pos = 0; pos < task->src.st.st_size; pos += 65536)
|
||||||
{
|
{
|
||||||
fsync(fd);
|
sz = 65536;
|
||||||
goto finish;
|
if ((task->src.st.st_size - pos) < sz) sz = task->src.st.st_size - pos;
|
||||||
|
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);
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (fsync(fd) == -1)
|
||||||
|
goto finish;
|
||||||
}
|
}
|
||||||
if (fsync(fd) == -1)
|
|
||||||
goto finish;
|
|
||||||
|
|
||||||
task->dst.done++;
|
task->dst.done++;
|
||||||
_e_fm_op_update_progress_report_simple((double)task->dst.done/NB_PASS*100, "/dev/urandom", task->src.name);
|
_e_fm_op_update_progress_report_simple((double)task->dst.done/NB_PASS*100, "/dev/urandom", task->src.name);
|
||||||
|
|
Loading…
Reference in New Issue