minor fixes

This commit is contained in:
The MMGen Project 2024-08-26 13:47:01 +00:00
commit 6d87cb3980
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 5 additions and 4 deletions

View file

@ -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:

View file

@ -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

View file

@ -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)