diff --git a/mt.1 b/mt.1 index 6c79d52..f02fc54 100644 --- a/mt.1 +++ b/mt.1 @@ -124,7 +124,10 @@ in the partition given by the argument after count. The default partition is zero. .IP mkpartition (SCSI tapes) Format the tape with one (count is zero) or two partitions -(count gives the size of the second partition in megabytes). The tape +(count gives the size of the second partition in megabytes). If the count is +positive, it specifies the size of partition 1. From kernel version 4.6, if +the count is negative, it specifies the size of partition 0. With older +kernels, a negative argument formats the tape with one partition. The tape drive must be able to format partitioned tapes with initiator-specified partition size and partition support must be enabled for the drive. @@ -282,6 +285,11 @@ Otherwise, a default device defined in the file is used (note that the actual path to .I mtio.h can vary per architecture and/or distribution). +.SH NOTES +The argument of mkpartition specifies the size of the partition in +megabytes. If you add a postfix, it applies to this definition. For example, +argument 1G means 1 giga megabytes, which probably is not what the user is +anticipating. .SH AUTHOR The program is written by Kai Makisara . .SH COPYRIGHT diff --git a/mt.c b/mt.c index 29c6add..331b75b 100644 --- a/mt.c +++ b/mt.c @@ -462,14 +462,14 @@ do_standard(int mtfd, cmdef_tr *cmd, int argc, char **argv) return 3; } max_count = INT_MAX / multiplier; - if (mt_com.mt_count > max_count) { + if (abs(mt_com.mt_count) > max_count) { fprintf(stderr, "mt: repeat count too large.\n"); return 3; } mt_com.mt_count *= multiplier; } mt_com.mt_count |= cmd->cmd_count_bits; - if (mt_com.mt_count < 0) { + if (mt_com.mt_op != MTMKPART && mt_com.mt_count < 0) { fprintf(stderr, "mt: negative repeat count\n"); return 1; }