diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-01-23 21:09:48 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-01-23 22:03:43 +0000 |
commit | d83eb4b9ff792080f3c0012f7e0b59ed3c8639ce (patch) | |
tree | b3d49e87e79189d36f700a440c0942d2afbfadbb | |
parent | 90f6080e6b27278fd3f50b0e96aa0df328d6b07d (diff) |
android: get osl_Pipe creation sorted out, before we kill it.
use new OSL_SOCKET_PATH bootstrap variable to customise this.
-rw-r--r-- | android/qa/desktop/Makefile | 2 | ||||
-rw-r--r-- | sal/osl/unx/pipe.c | 42 |
2 files changed, 41 insertions, 3 deletions
diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index 0076b6ff58dd..63399d7d8d85 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -33,6 +33,8 @@ buildrcs: echo "Logo=1" >> assets/program/lofficerc echo "NativeProgress=1" >> assets/program/lofficerc echo "URE_BOOTSTRAP=file:///assets/program/fundamentalrc" >> assets/program/lofficerc + echo "RTL_LOGFILE=file:///dev/log/main" >> assets/program/lofficerc + echo "OSL_SOCKET_PATH=$(APP_DATA_PATH)/files" >> assets/program/lofficerc # fundamentalrc ini ... echo "[Bootstrap]" > assets/program/fundamentalrc echo "LO_LIB_DIR=file://$(APP_DATA_PATH)/lib/" >> assets/program/fundamentalrc diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c index 6deac995123a..fd472fa18e43 100644 --- a/sal/osl/unx/pipe.c +++ b/sal/osl/unx/pipe.c @@ -32,6 +32,9 @@ #include <osl/diagnose.h> #include <osl/thread.h> #include <osl/interlck.h> +#include <rtl/string.h> +#include <rtl/ustring.h> +#include <rtl/bootstrap.h> #include "sockimpl.h" @@ -158,8 +161,38 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *ustrPipeName, oslPipeOptions Option } +static sal_Bool +cpyBootstrapSocketPath(sal_Char *name, size_t len) +{ + sal_Bool bRet = sal_False; + rtl_uString *pName = 0, *pValue = 0; + + rtl_uString_newFromAscii(&pName, "OSL_SOCKET_PATH"); + + if (rtl_bootstrap_get(pName, &pValue, NULL)) + { + rtl_String *pStrValue = 0; + if (pValue && pValue->length > 0) + { + rtl_uString2String(&pStrValue, pValue->buffer, + pValue->length, RTL_TEXTENCODING_UTF8, + OUSTRING_TO_OSTRING_CVTFLAGS); + if (pStrValue && pStrValue->length > 0) + { + size_t nCopy = SAL_MIN (len-1, (size_t)pStrValue->length); + strncpy (name, pStrValue->buffer, nCopy); + name[nCopy] = '\0'; + bRet = (size_t)pStrValue->length < len; + } + rtl_string_release(pStrValue); + } + rtl_uString_release(pName); + } + return bRet; +} + oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions Options, - oslSecurity Security) + oslSecurity Security) { int Flags; size_t len; @@ -174,10 +207,14 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions { strncpy(name, PIPEDEFAULTPATH, sizeof(name)); } - else + else if (access(PIPEALTERNATEPATH, R_OK|W_OK) == 0) { strncpy(name, PIPEALTERNATEPATH, sizeof(name)); } + else if (!cpyBootstrapSocketPath (name, sizeof (name))) + { + return NULL; + } name[sizeof(name) - 1] = '\0'; // ensure the string is NULL-terminated nNameLength = strlen(name); bNameTooLong = nNameLength > sizeof(name) - 2; @@ -600,5 +637,4 @@ sal_Int32 SAL_CALL osl_readPipe( oslPipe pPipe, void *pBuffer , sal_Int32 n ) return BytesRead; } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |