Commit Graph

19 Commits

Author SHA1 Message Date
Martin Ling 9118f753f4 linux: Fix compile warning on gcc 6+ for readlink() call.
Fixes #1268.
2020-01-04 18:24:00 +01:00
Christian Seiler fa106ef155 Use O_CLOEXEC where available
Ensures that the file descriptor is (by default) not passed to
subprocesses spawned by applications using libserialport.

This fixes bug #1051.
2020-01-04 18:21:35 +01:00
Aurelien Jacobs df3b70a888 use readdir() instead of the deprecated readir_r()
readir() is threadsafe on both linux and freebsd anyway.
The rationale behind the readdir_r() deprecation is in the glibc manual:
https://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html

This fixes the following warning with recent glibc:

linux.c: In function ‘list_ports’:
linux.c:197:2: warning: ‘readdir_r’ is deprecated [-Wdeprecated-declarations]
  while (!readdir_r(dir, &entry, &result) && result) {
  ^~~~~
2016-10-14 23:58:22 +02:00
Wolfram Sang 0c3f38b81b linux: freebsd: do check on proper pointer
We want to check here if we added something to the list, not if the
function argument was valid. Problem spotted by Coverity, CID 50754.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-02-28 18:01:25 +01:00
Daniel Elstner 1a584c45b0 Build: Include config.h first in all source files 2015-09-13 20:04:31 +02:00
Daniel Elstner f1c916ede1 Build: Clean up configure.ac and Makefile.am
Among other things, rename some config defines so we can take
advantage of standard Autoconf macros.
2015-08-26 21:55:10 +02:00
Martin Ling f77bb46df5 Update copyright notices. 2015-05-31 18:26:53 +02:00
silverbuddy 46d8b0a039 Handle the case when /sys/class/tty/ entries are not symlinks.
For example:

$ uname -a
Linux RT-N66U 2.6.22.19 #1 Thu Feb 12 20:33:36 CST 2015 mips GNU/Linux

$ ls -lF /sys/class/tty/
drwxr-xr-x    2 foo  root             0 May 18 18:12 ttyACM0/

$ ls -lF /sys/class/tty/ttyACM0/
-r--r--r--    1 foo  root          4096 May 18 18:12 dev
lrwxrwxrwx    1 foo  root             0 May 18 18:12 device -> ../../../devices/pci0000:00/0000:00:04.1/usb1/1-1/1-1.1/1-1.1:1.0/
lrwxrwxrwx    1 foo  root             0 May 18 18:12 subsystem -> ../../../class/tty/
-rw-r--r--    1 foo  root          4096 May 18 18:12 uevent
2015-05-27 11:09:26 +02:00
Uwe Hermann dc422c04af Various cosmetic and consistency fixes. 2015-03-26 23:57:56 +01:00
Uwe Hermann 7c1101dc08 Fix misleading snprintf() arguments. 2015-02-20 18:57:08 +01:00
Uffe Jakobsen ea17bfca3d If present, add usb_serial to description for better identification 2015-02-20 18:54:12 +01:00
Aurelien Jacobs 653cef3ab1 linux: remove readlinkat() dependency 2014-09-04 20:13:55 +02:00
Martin Ling 0666ccc7ca linux: Fix warning by marking vid, pid variables unsigned. 2014-08-24 14:08:00 +01:00
Martin Ling 7890cef6cf Revise debug macros to work in strict C99. 2014-08-24 14:06:21 +01:00
Marcus Comstedt 12056e2f75 Avoid use of struct serial_struct on systems which don't have it (Android)
This fixes bug #376.
2014-07-06 14:16:56 +02:00
Marcus Comstedt 5bd33b7c8b Don't use readlinkat if it does not exist
This fixes bug #377.
2014-07-06 14:15:46 +02:00
Aurelien Jacobs 970f279ae4 Introduce SP_API/SP_PRIV to mark visibility of functions. 2014-07-02 14:43:32 +02:00
Aurelien Jacobs 48a4076f69 Move list_ports() implementations to OS-specific files. 2014-06-14 01:28:49 +02:00
Martin Ling e33dcf90a0 Tidy up and split most OS-specific code to separate files. 2014-06-11 15:10:29 +01:00