Browse Source

minor fixes

The MMGen Project 7 months ago
parent
commit
6d87cb3980
3 changed files with 5 additions and 4 deletions
  1. 2 2
      mmgen/filename.py
  2. 2 1
      mmgen/fileutil.py
  3. 1 1
      test/tooltest2.py

+ 2 - 2
mmgen/filename.py

@@ -42,9 +42,9 @@ class File:
 
 		import stat
 		if stat.S_ISBLK(st.st_mode):
+			if sys.platform in ('win32',):
+				die(2, 'Access to raw block devices not supported on platform {sys.platform!r}')
 			mode = (os.O_RDONLY,os.O_RDWR)[bool(write)]
-			if sys.platform == 'win32':
-				mode |= os.O_BINARY
 			try:
 				fd = os.open(fn, mode)
 			except OSError as e:

+ 2 - 1
mmgen/fileutil.py

@@ -86,7 +86,8 @@ def _check_file_type_and_access(fname,ftype,blkdev_ok=False):
 			(stat.S_ISLNK,'symbolic link')
 		]
 		if blkdev_ok:
-			ok_types.append((stat.S_ISBLK,'block device'))
+			if not sys.platform in ('win32',):
+				ok_types.append((stat.S_ISBLK, 'block device'))
 
 	try:
 		mode = os.stat(fname).st_mode

+ 1 - 1
test/tooltest2.py

@@ -345,5 +345,5 @@ if cfg.fork:
 
 from mmgen.main import launch
 start_time = int(time.time())
-launch(func=lambda: main())
+launch(func=main)
 end_msg(int(time.time()) - start_time)