Be carefull with readlink. It is a tricky libc call.
From: Erik Hovland <erik@hovland.org>
---
libs/libmyth/mediamonitor-unix.cpp | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libs/libmyth/mediamonitor-unix.cpp b/libs/libmyth/mediamonitor-unix.cpp
index 3bc43ca..75ce967 100644
a
|
b
|
|
2 | 2 | |
3 | 3 | // Standard C headers |
4 | 4 | #include <cstdio> |
| 5 | #include <errno.h> |
5 | 6 | |
6 | 7 | // POSIX headers |
7 | 8 | #include <dirent.h> |
… |
… |
bool MediaMonitorUnix::AddDevice(const char* devPath) |
469 | 470 | int len = readlink(devicePath, lpath, PATH_MAX); |
470 | 471 | if (len > 0 && len < PATH_MAX) |
471 | 472 | lpath[len] = 0; |
| 473 | else if (len == -1 && errno != EINVAL) |
| 474 | return false; |
472 | 475 | |
473 | 476 | // Attempt to open the file system descriptor entry. |
474 | 477 | if (!setfsent()) |