diff --git a/src/bin/e_fm_op.c b/src/bin/e_fm_op.c index fa8dc3c1f..b76c99f57 100644 --- a/src/bin/e_fm_op.c +++ b/src/bin/e_fm_op.c @@ -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,22 +1712,27 @@ _e_fm_op_destroy_atom(E_Fm_Op_Task *task) task->src.st.st_size = st2.st_size; } - if (lseek(fd, SEEK_SET, 0) == -1) - goto finish; - - for (pos = 0; pos < task->src.st.st_size; pos += 65536) + for (cnt = 0; cnt < overwrite_count; cnt++) { - 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 (write(fd, buf, sz) != sz) + if (lseek(fd, SEEK_SET, 0) == -1) + goto finish; + + for (pos = 0; pos < task->src.st.st_size; pos += 65536) { - fsync(fd); - goto finish; + 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) + // 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++; _e_fm_op_update_progress_report_simple((double)task->dst.done/NB_PASS*100, "/dev/urandom", task->src.name);