diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2013-08-20 20:17:14 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2013-08-20 20:17:14 +0000 |
commit | 30990eaa2756af326d9f0100944b2340835f5434 (patch) | |
tree | 7c8d0d177c11b68d484fc5239359711a3bfb1fd1 /winsup/cygwin/fhandler_tape.cc | |
parent | f9268dfd7a869c5cc3009c8ea1f9a963beaf8c43 (diff) | |
download | newlib-30990eaa2756af326d9f0100944b2340835f5434.zip newlib-30990eaa2756af326d9f0100944b2340835f5434.tar.gz newlib-30990eaa2756af326d9f0100944b2340835f5434.tar.bz2 |
* fhandler_tape.cc (mtinfo_drive::create_partitions): Fix long-standing
bug disabling creation of two partitions on drives supporting initiator
partitions.
(mtinfo_drive::set_blocksize): Update media information after setting
blocksize succeeded.
(mtinfo_drive::get_status): Fetch fresh media information.
Diffstat (limited to 'winsup/cygwin/fhandler_tape.cc')
-rw-r--r-- | winsup/cygwin/fhandler_tape.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler_tape.cc b/winsup/cygwin/fhandler_tape.cc index 2b84830..8002b95 100644 --- a/winsup/cygwin/fhandler_tape.cc +++ b/winsup/cygwin/fhandler_tape.cc @@ -557,9 +557,8 @@ mtinfo_drive::create_partitions (HANDLE mt, int32_t count) debug_printf ("Format tape with %s partition(s)", count <= 0 ? "one" : "two"); if (get_feature (TAPE_DRIVE_INITIATOR)) { - if (count <= 0) - TAPE_FUNC (CreateTapePartition (mt, TAPE_INITIATOR_PARTITIONS, - count <= 0 ? 0 : 2, (DWORD) count)); + TAPE_FUNC (CreateTapePartition (mt, TAPE_INITIATOR_PARTITIONS, + count <= 0 ? 0 : 2, (DWORD) count)); } else if (get_feature (TAPE_DRIVE_FIXED)) { @@ -741,7 +740,8 @@ mtinfo_drive::set_blocksize (HANDLE mt, DWORD count) { TAPE_SET_MEDIA_PARAMETERS smp = {count}; TAPE_FUNC (SetTapeParameters (mt, SET_TAPE_MEDIA_INFORMATION, &smp)); - return error ("set_blocksize"); + /* Make sure to update blocksize info! */ + return lasterr ? error ("set_blocksize") : get_mp (mt); } int @@ -756,6 +756,9 @@ mtinfo_drive::get_status (HANDLE mt, struct mtget *get) if ((tstat = GetTapeStatus (mt)) == ERROR_NO_MEDIA_IN_DRIVE) notape = 1; + if (get_mp (mt)) + return lasterr; + memset (get, 0, sizeof *get); get->mt_type = MT_ISUNKNOWN; |