summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/mutex.c6
-rw-r--r--sal/osl/unx/nlsupport.c38
-rw-r--r--sal/osl/unx/pipe.c4
-rw-r--r--sal/osl/unx/process.c15
-rw-r--r--sal/osl/unx/profile.c13
-rw-r--r--sal/osl/unx/socket.c12
-rw-r--r--sal/osl/unx/util.c4
7 files changed, 43 insertions, 49 deletions
diff --git a/sal/osl/unx/mutex.c b/sal/osl/unx/mutex.c
index c44b33246..d4ca66d03 100644
--- a/sal/osl/unx/mutex.c
+++ b/sal/osl/unx/mutex.c
@@ -72,11 +72,11 @@ oslMutex SAL_CALL osl_createMutex()
pthread_mutexattr_init(&aMutexAttr);
nRet = pthread_mutexattr_settype(&aMutexAttr, PTHREAD_MUTEX_RECURSIVE);
-
- nRet = pthread_mutex_init(&(pMutex->mutex), &aMutexAttr);
+ if( nRet == 0 )
+ nRet = pthread_mutex_init(&(pMutex->mutex), &aMutexAttr);
if ( nRet != 0 )
{
- OSL_TRACE("osl_createMutex : mutex init failed. Errno: %d; %s\n",
+ OSL_TRACE("osl_createMutex : mutex init/setattr failed. Errno: %d; %s\n",
nRet, strerror(nRet));
free(pMutex);
diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c
index 426457195..a52874230 100644
--- a/sal/osl/unx/nlsupport.c
+++ b/sal/osl/unx/nlsupport.c
@@ -942,40 +942,28 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale )
set the current process locale
*****************************************************************************/
+static int
+_setenv (const char* name, const char* value)
+{
+ return setenv (name, value, 1);
+}
+
int _imp_setProcessLocale( rtl_Locale * pLocale )
{
char locale_buf[64];
-
+
/* convert rtl_Locale to locale string */
if( NULL != _compose_locale( pLocale, locale_buf, 64 ) )
{
/* only change env vars that exist already */
- if( getenv( "LC_ALL" ) ) {
-#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \
- defined( AIX ) || defined( OPENBSD ) || defined( DRAGONFLY )
- setenv( "LC_ALL", locale_buf, 1);
-#else
- setenv( "LC_ALL", locale_buf );
-#endif
- }
+ if( getenv( "LC_ALL" ) )
+ _setenv( "LC_ALL", locale_buf );
- if( getenv( "LC_CTYPE" ) ) {
-#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \
- defined( AIX ) || defined( OPENBSD ) || defined( DRAGONFLY )
- setenv("LC_CTYPE", locale_buf, 1 );
-#else
- setenv( "LC_CTYPE", locale_buf );
-#endif
- }
+ if( getenv( "LC_CTYPE" ) )
+ _setenv("LC_CTYPE", locale_buf );
- if( getenv( "LANG" ) ) {
-#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \
- defined( AIX ) || defined( OPENBSD) || defined( DRAGONFLY )
- setenv("LC_CTYPE", locale_buf, 1 );
-#else
- setenv( "LANG", locale_buf );
-#endif
- }
+ if( getenv( "LANG" ) )
+ _setenv( "LANG", locale_buf );
}
return 0;
diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c
index 6309e73e3..75569e5cf 100644
--- a/sal/osl/unx/pipe.c
+++ b/sal/osl/unx/pipe.c
@@ -376,12 +376,10 @@ void SAL_CALL osl_closePipe( oslPipe pPipe )
len = sizeof(addr);
nRet = connect( fd, (struct sockaddr *)&addr, len);
-#if OSL_DEBUG_LEVEL > 1
if ( nRet < 0 )
{
- perror("connect in osl_destroyPipe");
+ OSL_TRACE("connect in osl_destroyPipe failed with error: %s", strerror(errno));
}
-#endif /* OSL_DEBUG_LEVEL */
close(fd);
}
#endif /* LINUX */
diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c
index bc868edad..5c07ee5f9 100644
--- a/sal/osl/unx/process.c
+++ b/sal/osl/unx/process.c
@@ -378,6 +378,16 @@ static oslSocket receiveFdPipe(int PipeFD)
if ( !safeWrite(PipeFD, &nRetCode, sizeof(nRetCode)) )
OSL_TRACE("write failed (%s)", strerror(errno));
+ if ( nRead < 0 )
+ {
+ OSL_TRACE("write failed (%s)", strerror(errno));
+ }
+ else if ( nRead != sizeof(nRetCode) )
+ {
+ // TODO: Handle this case.
+ OSL_TRACE("partial write: wrote %d out of %d)", nRead, sizeof(nRetCode));
+ }
+
#if defined(IOCHANNEL_TRANSFER_BSD_RENO)
free(cmptr);
#endif
@@ -535,8 +545,9 @@ static void ChildStatusProc(void *pData)
if (stdError[1] != -1) close( stdError[1] );
}
- pid=execv(data.m_pszArgs[0], (sal_Char **)data.m_pszArgs);
-
+ // No need to check the return value of execv. If we return from
+ // it, an error has occurred.
+ execv(data.m_pszArgs[0], (sal_Char **)data.m_pszArgs);
}
OSL_TRACE("Failed to exec, errno=%d (%s)\n", errno, strerror(errno));
diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c
index 3e1a314c3..4a245c308 100644
--- a/sal/osl/unx/profile.c
+++ b/sal/osl/unx/profile.c
@@ -275,6 +275,7 @@ static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, o
sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile)
{
osl_TProfileImpl* pProfile = (osl_TProfileImpl*)Profile;
+ osl_TProfileImpl* pTmpProfile;
#ifdef TRACE_OSL_PROFILE
OSL_TRACE("In osl_closeProfile\n");
@@ -304,22 +305,22 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile)
if ( ! ( pProfile->m_Flags & osl_Profile_READLOCK ) && ( pProfile->m_Flags & FLG_MODIFIED ) )
{
- pProfile = acquireProfile(Profile,sal_True);
+ pTmpProfile = acquireProfile(Profile,sal_True);
- if ( pProfile != 0 )
+ if ( pTmpProfile != 0 )
{
- sal_Bool bRet = storeProfile(pProfile, sal_True);
+ sal_Bool bRet = storeProfile(pTmpProfile, sal_True);
OSL_ASSERT(bRet);
(void)bRet;
}
}
else
{
- pProfile = acquireProfile(Profile,sal_False);
+ pTmpProfile = acquireProfile(Profile,sal_False);
}
- if ( pProfile == 0 )
+ if ( pTmpProfile == 0 )
{
pthread_mutex_unlock(&(pProfile->m_AccessLock));
#ifdef TRACE_OSL_PROFILE
@@ -328,6 +329,8 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile)
return sal_False;
}
+ pProfile = pTmpProfile;
+
if (pProfile->m_pFile != NULL)
closeFileImpl(pProfile->m_pFile,pProfile->m_Flags);
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index 3f317791f..b9fb92e42 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -1705,12 +1705,10 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
socklen_t nSockLen = sizeof(s.aSockAddr);
nRet = getsockname(nFD, &s.aSockAddr, &nSockLen);
-#if OSL_DEBUG_LEVEL > 1
if ( nRet < 0 )
{
- perror("getsockname");
+ OSL_TRACE("getsockname call failed with error: %s", strerror(errno));
}
-#endif /* OSL_DEBUG_LEVEL */
if ( s.aSockAddr.sa_family == AF_INET )
{
@@ -1720,20 +1718,16 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
}
nConnFD = socket(AF_INET, SOCK_STREAM, 0);
-#if OSL_DEBUG_LEVEL > 1
if ( nConnFD < 0 )
{
- perror("socket");
+ OSL_TRACE("socket call failed with error: %s", strerror(errno));
}
-#endif /* OSL_DEBUG_LEVEL */
nRet = connect(nConnFD, &s.aSockAddr, sizeof(s.aSockAddr));
-#if OSL_DEBUG_LEVEL > 1
if ( nRet < 0 )
{
- perror("connect");
+ OSL_TRACE("connect call failed with error: %s", strerror(errno));
}
-#endif /* OSL_DEBUG_LEVEL */
close(nConnFD);
}
pSocket->m_bIsAccepting = sal_False;
diff --git a/sal/osl/unx/util.c b/sal/osl/unx/util.c
index cc6361851..fe68c480d 100644
--- a/sal/osl/unx/util.c
+++ b/sal/osl/unx/util.c
@@ -162,7 +162,7 @@ static int osl_getHWAddr(const char *ifname, char* hard_addr)
* And now, the real thing: the get address
*/
-#ifdef SIOCGIFHWADDR
+#if defined(SIOCGIFHWADDR) && !defined(SOLARIS)
ret=ioctl(so, SIOCGIFHWADDR, &ifr);
#else
ret=ioctl(so, SIOCGIFADDR, &ifr);
@@ -177,7 +177,7 @@ static int osl_getHWAddr(const char *ifname, char* hard_addr)
close(so);
-#ifdef SIOCGIFHWADDR
+#if defined(SIOCGIFHWADDR) && !defined(SOLARIS)
memcpy(hard_addr,ifr.ifr_hwaddr.sa_data,8);
#else
memcpy(hard_addr,ifr.ifr_ifru.ifru_addr.sa_data,8);