DISK: Properly fail an attempt to access to a non-existent file in raw mode
This commit is contained in:
parent
6667f651a3
commit
8bec55b976
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue