diff --git a/ntfsprogs/ntfswipe.8.in b/ntfsprogs/ntfswipe.8.in index 375b4703..b21e8c9e 100644 --- a/ntfsprogs/ntfswipe.8.in +++ b/ntfsprogs/ntfswipe.8.in @@ -35,7 +35,9 @@ the unused space. BYTE-LIST is a comma-separated list of values in range 0-255 expressed in octal, decimal or hexadecimal base. .TP \fB\-c\fR, \fB\-\-count\fR NUM -Define the number of times the unused space is to be overwritten. +Define the number of times the unused space is to be overwritten. If both +options \fB\-\-bytes\fR and \fB\-\-count\fR are set, the space is +repeatedly overwritten this number of times by each of the values in the list. .TP \fB\-d\fR, \fB\-\-directory\fR Wipe all the directory indexes, which may contain names of deleted files. @@ -68,7 +70,9 @@ Suppress some debug/warning/error messages. .TP \fB\-s\fR, \fB\-\-undel\fR Overwrite the space which had been allocated to a file which has been deleted -recently and is still undeletable. +recently and is still undeletable. This option is not compatible with +\fB\-\-bytes\fR and the replacement bytes are random ones or taken from a +standard list. .TP \fB\-t\fR, \fB\-\-tails\fR Overwrite the space at the end of files which is unused, but allocated diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 52e075d1..b41f6168 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -403,6 +403,10 @@ static int parse_options(int argc, char *argv[]) } } + if (opts.bytes && opts.undel) { + ntfs_log_error("Options --bytes and --undel are not compatible.\n"); + err++; + } /* Make sure we're in sync with the log levels */ levels = ntfs_log_get_levels(); if (levels & NTFS_LOG_LEVEL_VERBOSE) @@ -1661,12 +1665,12 @@ static void fill_buffer ( /* For other passes, one of the fixed patterns is selected. */ do { #if (!defined __STRICT_ANSI__) && (defined HAVE_RANDOM) - i = (size_t)(random() % NPAT); + i = (size_t)random() % NPAT; #else - i = (size_t)(rand() % NPAT); + i = (size_t)rand() % NPAT; #endif } while (selected[i] == 1); - bits = opts.bytes[i]; + bits = patterns[i]; selected[i] = 1; } @@ -2123,6 +2127,9 @@ static void print_summary(void) ntfs_log_quiet("0x%02x ", opts.bytes[i]); } ntfs_log_quiet("\n"); + if (opts.undel) + ntfs_log_quiet("(however undelete data will be overwritten" + " by random values)\n"); if (opts.count > 1) ntfs_log_quiet("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count);