Bug 1491 - On Windows, sp_get_port_by_name() does not return an error for a non-existent port.
Summary: On Windows, sp_get_port_by_name() does not return an error for a non-existent...
Status: CONFIRMED
Alias: None
Product: libserialport
Classification: Unclassified
Component: Portability (show other bugs)
Version: unreleased development snapshot
Hardware: All Windows
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-25 21:34 CET by Martin Ling
Modified: 2020-01-25 21:34 CET (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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().