mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-26 15:24:15 +02:00
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_shroff = -1; /* /// Added for SHARE - Ron Cemer */
|
||||||
sftp->sft_attrib = attrib = attrib | D_ARCHIVE;
|
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)
|
if (result & IS_NETWORK)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
@ -535,18 +547,6 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
|
|||||||
return status;
|
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 */
|
/* First test the flags to see if the user has passed a valid */
|
||||||
/* file mode... */
|
/* file mode... */
|
||||||
if ((flags & O_ACCMODE) > 2)
|
if ((flags & O_ACCMODE) > 2)
|
||||||
|
@ -299,9 +299,23 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
|
|||||||
else
|
else
|
||||||
result = default_drive;
|
result = default_drive;
|
||||||
|
|
||||||
|
dhp = IsDevice(src);
|
||||||
|
|
||||||
cdsEntry = get_cds(result);
|
cdsEntry = get_cds(result);
|
||||||
if (cdsEntry == NULL)
|
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));
|
fmemcpy(&TempCDS, cdsEntry, sizeof(TempCDS));
|
||||||
tn_printf(("CDS entry: #%u @%p (%u) '%s'\n", result, cdsEntry,
|
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)
|
if (TempCDS.cdsFlags & CDSNETWDRV)
|
||||||
result |= IS_NETWORK;
|
result |= IS_NETWORK;
|
||||||
|
|
||||||
dhp = IsDevice(src); /* returns header if -char- device */
|
|
||||||
if (dhp)
|
if (dhp)
|
||||||
result |= IS_DEVICE;
|
result |= IS_DEVICE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user