mirror of https://github.com/FDOS/kernel.git
Fix an error at opening a character device prefixed with invalid drive letter (e.g. "@:NUL")
(some application use it for opening character device driver)
This commit is contained in:
parent
2394f842ce
commit
bc4615093a
|
@ -503,6 +503,18 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
|
|||
sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */
|
||||
sftp->sft_attrib = attrib = attrib | D_ARCHIVE;
|
||||
|
||||
/* check for a device */
|
||||
if ((result & IS_DEVICE) && (dhp = IsDevice(fname)) != NULL)
|
||||
{
|
||||
int rc = DeviceOpenSft(dhp, sftp);
|
||||
/* check the status code returned by the
|
||||
* driver when we tried to open it
|
||||
*/
|
||||
if (rc < SUCCESS)
|
||||
return rc;
|
||||
return sft_idx;
|
||||
}
|
||||
|
||||
if (result & IS_NETWORK)
|
||||
{
|
||||
int status;
|
||||
|
@ -535,18 +547,6 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
|
|||
return status;
|
||||
}
|
||||
|
||||
/* check for a device */
|
||||
if ((result & IS_DEVICE) && (dhp = IsDevice(fname)) != NULL)
|
||||
{
|
||||
int rc = DeviceOpenSft(dhp, sftp);
|
||||
/* check the status code returned by the
|
||||
* driver when we tried to open it
|
||||
*/
|
||||
if (rc < SUCCESS)
|
||||
return rc;
|
||||
return sft_idx;
|
||||
}
|
||||
|
||||
/* First test the flags to see if the user has passed a valid */
|
||||
/* file mode... */
|
||||
if ((flags & O_ACCMODE) > 2)
|
||||
|
|
|
@ -299,9 +299,23 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
|
|||
else
|
||||
result = default_drive;
|
||||
|
||||
dhp = IsDevice(src);
|
||||
|
||||
cdsEntry = get_cds(result);
|
||||
if (cdsEntry == NULL)
|
||||
return DE_PATHNOTFND;
|
||||
{
|
||||
/* workaround for a device prefixed with invalid drive (e.g. "@:NUL") */
|
||||
/* (MS-DOS always return drive P: for invalid drive. Why P:?) */
|
||||
if (dhp)
|
||||
{
|
||||
result = default_drive;
|
||||
cdsEntry = get_cds(result);
|
||||
if (cdsEntry == NULL)
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
else
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
|
||||
fmemcpy(&TempCDS, cdsEntry, sizeof(TempCDS));
|
||||
tn_printf(("CDS entry: #%u @%p (%u) '%s'\n", result, cdsEntry,
|
||||
|
@ -312,7 +326,6 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
|
|||
if (TempCDS.cdsFlags & CDSNETWDRV)
|
||||
result |= IS_NETWORK;
|
||||
|
||||
dhp = IsDevice(src); /* returns header if -char- device */
|
||||
if (dhp)
|
||||
result |= IS_DEVICE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue