]> sigrok.org Git - libserialport.git/commitdiff
linux: remove readlinkat() dependency
authorAurelien Jacobs <redacted>
Thu, 4 Sep 2014 18:13:55 +0000 (20:13 +0200)
committerAurelien Jacobs <redacted>
Thu, 4 Sep 2014 18:13:55 +0000 (20:13 +0200)
configure.ac
libserialport_internal.h
linux.c

index 457d6f910f40531cd2f79119644abfef347ab787..96d5277bb23a5204682365a0582ea2f04d823250 100644 (file)
@@ -119,9 +119,6 @@ AC_CHECK_MEMBERS([struct termios.c_ispeed, struct termios.c_ospeed],
 AC_CHECK_MEMBERS([struct termios2.c_ispeed, struct termios2.c_ospeed],
        [AC_DEFINE(HAVE_TERMIOS2_SPEED, 1)], [], [[#include <linux/termios.h>]])
 
-# Check for readlinkat.
-AC_CHECK_FUNC([readlinkat], [AC_DEFINE(HAVE_READLINKAT, 1)], [])
-
 # Check for serial_struct.
 AC_CHECK_TYPE([struct serial_struct], [AC_DEFINE(HAVE_SERIAL_STRUCT, 1)],
         [], [[#include <linux/serial.h>]])
index bef84b66f26f061bb4fdd791667d806446fcb3b9..9d582f8e72fbef5a1009b2f31d234ddedd737be1 100644 (file)
@@ -20,7 +20,6 @@
 
 #ifdef __linux__
 #define _BSD_SOURCE // for timeradd, timersub, timercmp
-#define _XOPEN_SOURCE 700 // for readlinkat
 #endif
 
 #include <string.h>
diff --git a/linux.c b/linux.c
index e995347ada193f049e1930ac0afafcc6f754ec29..61446a4171ae863034b2cf75b3ff81efc2dff0e8 100644 (file)
--- a/linux.c
+++ b/linux.c
@@ -165,9 +165,7 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list)
        struct serial_struct serial_info;
        int ioctl_result;
 #endif
-#ifndef HAVE_READLINKAT
        char buf[sizeof(entry.d_name) + 16];
-#endif
        int len, fd;
        DIR *dir;
        int ret = SP_OK;
@@ -178,12 +176,8 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list)
 
        DEBUG("Iterating over results");
        while (!readdir_r(dir, &entry, &result) && result) {
-#ifdef HAVE_READLINKAT
-               len = readlinkat(dirfd(dir), entry.d_name, target, sizeof(target));
-#else
                snprintf(buf, sizeof(buf), "/sys/class/tty/%s", entry.d_name);
                len = readlink(buf, target, sizeof(target));
-#endif
                if (len <= 0 || len >= (int) sizeof(target)-1)
                        continue;
                target[len] = 0;