Bug 1491

Summary: On Windows, sp_get_port_by_name() does not return an error for a non-existent port.
Product: libserialport Reporter: Martin Ling <martin-sigrokbugs>
Component: PortabilityAssignee: Nobody <nobody>
Status: CONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unreleased development snapshot   
Target Milestone: ---   
Hardware: All   
OS: Windows   

Description Martin Ling 2020-01-25 21:34:13 CET
On non-Windows platforms, a non-existent port name passed to sp_get_port_by_name() will result in SP_ERR_FAIL with ENOENT.

On Windows, where port names are not file paths, there is no initial call to readpath(), and the Windows implementation of get_port_details() fails silently.

As a result, it is possible to get an sp_port struct for a non-existent port and try to obtain metadata from it without errors.

An error will still be returned on sp_open().