1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

linux: remove readlinkat() dependency

This commit is contained in:
Aurelien Jacobs
2014-09-04 20:13:55 +02:00
parent 546e9ae5c5
commit 653cef3ab1
3 changed files with 0 additions and 10 deletions

View File

@@ -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;