From be9e1e020bb5a32c645688228104d6c69d1ed695 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 22 Feb 2017 06:21:21 +0100 Subject: [PATCH] src/system/helpers.cpp: Add function readLink() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0c182785e23b5e266338756cb8ba6efe193eefbf Author: Michael Liebmann Date: 2017-02-22 (Wed, 22 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/system/helpers.cpp | 10 ++++++++++ src/system/helpers.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index e6e4a1e2e..59d64524a 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -1272,3 +1272,13 @@ std::string Lang2ISO639_1(std::string& lang) return ret; } + +string readLink(string lnk) +{ + char buf[PATH_MAX]; + memset(buf, 0, sizeof(buf)-1); + if (readlink(lnk.c_str(), buf, sizeof(buf)-1) != -1) + return (string)buf; + + return ""; +} diff --git a/src/system/helpers.h b/src/system/helpers.h index e117e011e..c7f3ae06a 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -148,5 +148,6 @@ bool split_config_string(const std::string &str, std::map