From 0bcd933e704b0365e89c3b6f5ae314e188225bae Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Mon, 28 Apr 2014 16:54:58 +0200 Subject: [PATCH] wtsapi: add fallback to load freerds lib Try to load libfreerds-fdsapi.so directly if the freerds ini file isn't found. This adds a fallback that uses the systems library loading mechanisms (e.g LD_LIBRARY_PATH). Might also be required for older version of FreeRDS. --- winpr/libwinpr/wtsapi/wtsapi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/winpr/libwinpr/wtsapi/wtsapi.c b/winpr/libwinpr/wtsapi/wtsapi.c index 2d71595ce..02cf985cb 100644 --- a/winpr/libwinpr/wtsapi/wtsapi.c +++ b/winpr/libwinpr/wtsapi/wtsapi.c @@ -436,6 +436,7 @@ void InitializeWtsApiStubs_Env() LoadAndInitialize(env); } +#define FREERDS_LIBRARY_NAME "libfreerds-fdsapi.so" void InitializeWtsApiStubs_FreeRDS() { char* prefix; @@ -449,7 +450,10 @@ void InitializeWtsApiStubs_FreeRDS() if (IniFile_Parse(ini, "/var/run/freerds.instance") < 0) { + IniFile_Free(ini); fprintf(stderr, "failed to parse freerds.instance\n"); + LoadAndInitialize(FREERDS_LIBRARY_NAME); + return; } prefix = IniFile_GetKeyValueString(ini, "FreeRDS", "prefix"); @@ -463,7 +467,7 @@ void InitializeWtsApiStubs_FreeRDS() char* wtsapi_library; prefix_libdir = GetCombinedPath(prefix, libdir); - wtsapi_library = GetCombinedPath(prefix_libdir, "libfreerds-fdsapi.so"); + wtsapi_library = GetCombinedPath(prefix_libdir, FREERDS_LIBRARY_NAME); if (wtsapi_library) {