From: Pierre Ossman Date: Tue, 29 May 2018 14:46:19 +0000 (+0200) Subject: Merge branch 'unix' of https://github.com/CendioOssman/tigervnc X-Git-Tag: v1.8.90~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fe2e5fca2135acec490dc7284cfbca86ebe2610b;p=tigervnc.git Merge branch 'unix' of https://github.com/CendioOssman/tigervnc --- fe2e5fca2135acec490dc7284cfbca86ebe2610b diff --cc vncviewer/vncviewer.cxx index e305d798,f22648d4..6c0c7384 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@@ -369,28 -368,6 +369,40 @@@ static void usage(const char *programNa exit(1); } +static void +potentiallyLoadConfigurationFile(char *vncServerName) +{ + const bool hasPathSeparator = (strchr(vncServerName, '/') != NULL || + (strchr(vncServerName, '\\')) != NULL); + + if (hasPathSeparator) { ++#ifndef WIN32 ++ struct stat sb; ++ ++ // This might be a UNIX socket, we need to check ++ if (stat(vncServerName, &sb) == -1) { ++ // Some access problem; let loadViewerParameters() deal with it... ++ } else { ++ if ((sb.st_mode & S_IFMT) == S_IFSOCK) ++ return; ++ } ++#endif ++ + try { + const char* newServerName; + newServerName = loadViewerParameters(vncServerName); + // This might be empty, but we still need to clear it so we + // don't try to connect to the filename + strncpy(vncServerName, newServerName, VNCSERVERNAMELEN); + } catch (rfb::Exception& e) { + vlog.error("%s", e.str()); + if (alertOnFatalError) + fl_alert("%s", e.str()); + exit(EXIT_FAILURE); + } + } +} + #ifndef WIN32 static int interpretViaParam(char *remoteHost, int *remotePort, int localPort)