mirror of
https://github.com/open-simh/simh.git
synced 2026-04-30 05:35:22 +00:00
DISK: Properly fail an attempt to access to a non-existent file in raw mode
This commit is contained in:
@@ -2622,6 +2622,12 @@ if (strchr (openmode, 'r') && (strchr (openmode, '+') || strchr (openmode, 'w'))
|
|||||||
else
|
else
|
||||||
if (strchr (openmode, 'r'))
|
if (strchr (openmode, 'r'))
|
||||||
mode = O_RDONLY;
|
mode = O_RDONLY;
|
||||||
|
if (mode == O_RDONLY) {
|
||||||
|
struct stat statb;
|
||||||
|
|
||||||
|
if (stat (rawdevicename, &statb)) /* test for existence/access */
|
||||||
|
return (FILE *)NULL;
|
||||||
|
}
|
||||||
#ifdef O_LARGEFILE
|
#ifdef O_LARGEFILE
|
||||||
mode |= O_LARGEFILE;
|
mode |= O_LARGEFILE;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user