Commit ec7c19f6 authored by Alex Henrie's avatar Alex Henrie Committed by Vitaly Lipatov

mountmgr.sys: Do a device check before returning a default serial port name.

parent 253f6bfd
......@@ -1865,7 +1865,7 @@ static BOOL create_port_device( DRIVER_OBJECT *driver, int n, const char *unix_p
UNICODE_STRING nt_name, symlink_name, default_name;
DEVICE_OBJECT *dev_obj;
NTSTATUS status;
struct set_dosdev_symlink_params params = { dosdevices_path, unix_path };
struct set_dosdev_symlink_params params = { dosdevices_path, unix_path, driver == serial_driver };
/* create DOS device */
if (MOUNTMGR_CALL( set_dosdev_symlink, &params )) return FALSE;
......
......@@ -46,6 +46,7 @@
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#include <termios.h>
#include "unixlib.h"
......@@ -268,6 +269,27 @@ static NTSTATUS set_dosdev_symlink( void *args )
char *path;
NTSTATUS status = STATUS_SUCCESS;
#ifdef linux
/* Serial port device files almost always exist on Linux even if the corresponding serial
* ports don't exist. Do a basic functionality check before advertising a serial port. */
if (params->serial)
{
struct termios tios;
int fd;
if ((fd = open( params->dest, O_RDONLY )) == -1)
return FALSE;
if (tcgetattr( fd, &tios ) == -1)
{
close( fd );
return FALSE;
}
close( fd );
}
#endif
if (!(path = get_dosdevices_path( params->dev ))) return STATUS_NO_MEMORY;
if (params->dest && params->dest[0])
......
......@@ -75,6 +75,7 @@ struct set_dosdev_symlink_params
{
const char *dev;
const char *dest;
BOOL serial;
};
struct get_volume_dos_devices_params
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment