diff options
author | mfe <mfe@openoffice.org> | 2001-02-26 15:17:50 +0000 |
---|---|---|
committer | mfe <mfe@openoffice.org> | 2001-02-26 15:17:50 +0000 |
commit | ad0bdc51df26281aa3347f03f36b5c2b0fe631e5 (patch) | |
tree | b3a9721280954e7ecadea01273a58786af88b725 /sal | |
parent | 27b99da5a6c7efc2e3bbaf74de49140dbc702922 (diff) |
#84329#
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/diagnose.c | 8 | ||||
-rw-r--r-- | sal/osl/unx/process.c | 53 | ||||
-rw-r--r-- | sal/osl/unx/profile.c | 72 | ||||
-rw-r--r-- | sal/osl/unx/security.c | 39 |
4 files changed, 120 insertions, 52 deletions
diff --git a/sal/osl/unx/diagnose.c b/sal/osl/unx/diagnose.c index ca14d27b38a6..297d21e60f45 100644 --- a/sal/osl/unx/diagnose.c +++ b/sal/osl/unx/diagnose.c @@ -2,9 +2,9 @@ * * $RCSfile: diagnose.c,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: hro $ $Date: 2000-10-31 12:00:18 $ + * last change: $Author: mfe $ $Date: 2001-02-26 16:17:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -107,7 +107,9 @@ sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nL if ( _pPrintDebugMessage ) { - sal_Char szMessage[1024] = ""; + sal_Char szMessage[1024]; + szMessage[0] = '\0'; + sprintf(szMessage, "Assertion Failed: %s: File %s, Line %lu: %s", lpszAppName, pszFileName, nLine, pszMessage); _pPrintDebugMessage( szMessage ); diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c index 823112efac86..285bb2e69627 100644 --- a/sal/osl/unx/process.c +++ b/sal/osl/unx/process.c @@ -2,9 +2,9 @@ * * $RCSfile: process.c,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: mfe $ $Date: 2001-02-20 13:20:28 $ + * last change: $Author: mfe $ $Date: 2001-02-26 16:17:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -283,7 +283,9 @@ static sal_Char *getCmdLine() static sal_Char *getCmdLine() { FILE *fp; - sal_Char name[PATH_MAX + 1] = ""; + sal_Char name[PATH_MAX + 1]; + + name[0] = '\0'; sprintf(name, CMD_ARG_PROC_NAME, getpid()); @@ -321,9 +323,11 @@ static sal_Char *getCmdLine() static sal_Char *getCmdLine() { int fd; - sal_Char name[PATH_MAX + 1] = ""; + sal_Char name[PATH_MAX + 1]; sal_Char *pchr=0; + name[0] = '\0'; + sprintf(name, CMD_ARG_PROC_NAME, getpid()); if ((fd = open(name, O_RDONLY)) >= 0) @@ -372,9 +376,11 @@ static sal_Char *getCmdLine() static sal_Char *getCmdLine() { FILE *fp; - sal_Char cmd[CMD_ARG_MAX + 1] = ""; + sal_Char cmd[CMD_ARG_MAX + 1]; int i; + cmd[0] = '\0'; + sprintf(cmd, CMD_ARG_PS, getpid()); if (fp = popen(cmd, "r")) @@ -416,10 +422,13 @@ static sal_Char *getCmdLine() oslProcessError SAL_CALL osl_getExecutableFile(rtl_uString **ustrFile) { - sal_Char pszExecutable[PATH_MAX] = ""; - sal_Char pszUncPath[PATH_MAX+5] = ""; + sal_Char pszExecutable[PATH_MAX]; + sal_Char pszUncPath[PATH_MAX+5]; oslProcessError Error; + pszExecutable[0] = '\0'; + pszUncPath[0] = '\0'; + Error=osl_psz_getExecutableFile(pszExecutable,sizeof(pszExecutable)); if ( Error == osl_Process_E_None) @@ -481,10 +490,12 @@ oslProcessError SAL_CALL osl_psz_getExecutableFile(sal_Char* pszBuffer, sal_uInt sal_uInt32 SAL_CALL osl_getCommandArgCount() { - sal_Char pszBuffer[CMD_ARG_MAX+1] = ""; + sal_Char pszBuffer[CMD_ARG_MAX+1]; oslProcessError tErr = osl_Process_E_Unknown; + pszBuffer[0] = '\0'; + if ( nArgCount == -1 ) { tErr = osl_getCommandArgs(pszBuffer, sizeof(pszBuffer)); @@ -507,7 +518,9 @@ oslProcessError SAL_CALL osl_getCommandArg( sal_uInt32 nArg, rtl_uString **strCo if ( nArgCount == -1 ) { - sal_Char pBuffer[CMD_ARG_MAX+1] = ""; + sal_Char pBuffer[CMD_ARG_MAX+1]; + pBuffer[0] = '\0'; + tErr = osl_getCommandArgs(pBuffer, CMD_ARG_MAX+1); if ( tErr == osl_Process_E_None ) { @@ -616,7 +629,7 @@ static Pipe* openPipe(pid_t pid) #if defined(IORESOURCE_TRANSFER_SYSV) || defined(IORESOURCE_TRANSFER_BSD) int fd; - sal_Char name[PATH_MAX + 1] = ""; + sal_Char name[PATH_MAX + 1]; if (access(PIPEDEFAULTPATH, O_RDWR) == 0) strcpy(name, PIPEDEFAULTPATH); @@ -1623,10 +1636,12 @@ oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName, oslProcess *pProcess) { int i; - sal_Char path[PATH_MAX + 1] = ""; + sal_Char path[PATH_MAX + 1]; ProcessData Data; oslThread hThread; + path[0] = '\0'; + memset(&Data,0,sizeof(ProcessData)); if (pszImageName == NULL) @@ -2090,7 +2105,7 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F #if defined(SOLARIS) int fd; - sal_Char name[PATH_MAX + 1] = ""; + sal_Char name[PATH_MAX + 1]; sprintf(name, "/proc/%u", pid); @@ -2154,7 +2169,7 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F #elif defined(IRIX) int fd; - sal_Char name[PATH_MAX + 1] = ""; + sal_Char name[PATH_MAX + 1]; sprintf(name, "/proc/%u", pid); @@ -2301,10 +2316,12 @@ oslProcessError SAL_CALL osl_joinProcess(oslProcess Process) oslProcessError SAL_CALL osl_getEnvironment(rtl_uString *ustrVar, rtl_uString **ustrValue) { oslProcessError Error; - sal_Char pszValue[PATH_MAX] = ""; + sal_Char pszValue[PATH_MAX]; rtl_String* strVar=0; sal_Char* pszVar=0; + pszValue[0] = '\0'; + if ( ustrVar != 0 ) { rtl_uString2String( &strVar, @@ -2360,9 +2377,11 @@ oslProcessError SAL_CALL osl_psz_getEnvironment(const sal_Char* pszName, sal_Cha oslProcessError SAL_CALL osl_searchPath(const sal_Char* pszName, const sal_Char* pszPath, sal_Char Separator, sal_Char *pszBuffer, sal_uInt32 Max) { - sal_Char path[PATH_MAX + 1] = ""; + sal_Char path[PATH_MAX + 1]; sal_Char *pchr; + path[0] = '\0'; + OSL_ASSERT(pszName != NULL); if ( pszName == 0 ) @@ -2423,7 +2442,9 @@ sal_Bool osl_getFullPath(const sal_Char* pszFilename, sal_Char* pszPath, sal_uIn struct stat status; struct stat root; struct stat parent; - sal_Char Path[PATH_MAX + 1] = ""; + sal_Char Path[PATH_MAX + 1]; + + Path[0] = '\0'; pDir = strdup(pszFilename); diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c index a49b1742ab03..2282294a48a6 100644 --- a/sal/osl/unx/profile.c +++ b/sal/osl/unx/profile.c @@ -2,9 +2,9 @@ * * $RCSfile: profile.c,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: mfe $ $Date: 2001-02-20 13:20:28 $ + * last change: $Author: mfe $ $Date: 2001-02-26 16:17:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -271,9 +271,11 @@ oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, oslProfi { osl_TFile* pFile; osl_TProfileImpl* pProfile; - sal_Char Filename[PATH_MAX] = ""; + sal_Char Filename[PATH_MAX]; sal_Bool bRet = sal_False; + Filename[0] = '\0'; + #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_openProfile\n"); #endif @@ -698,7 +700,8 @@ sal_Bool SAL_CALL osl_readProfileBool(oslProfile Profile, const sal_Char* pszSection, const sal_Char* pszEntry, sal_Bool Default) { - sal_Char Line[32] = ""; + sal_Char Line[32]; + Line[0] = '\0'; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_readProfileBool\n"); @@ -731,7 +734,8 @@ sal_uInt32 SAL_CALL osl_readProfileIdent(oslProfile Profile, sal_uInt32 Default) { sal_uInt32 i; - sal_Char Line[256] = ""; + sal_Char Line[256]; + Line[0] = '\0'; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_readProfileIdent\n"); @@ -1232,13 +1236,15 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff sal_Bool SAL_CALL osl_getProfileName(rtl_uString* ustrPath, rtl_uString* ustrName, rtl_uString** strProfileName) { sal_Bool bRet=sal_False; - sal_Char pszBuffer[PATH_MAX] = ""; + sal_Char pszBuffer[PATH_MAX]; rtl_uString* strNativeName=0; rtl_String* strPath=0; rtl_String* strName=0; sal_Char* pszPath=0; sal_Char* pszName=0; + pszBuffer[0] = '\0'; + if ( ustrPath != 0 && ustrPath->buffer[0] != 0 ) { @@ -1304,14 +1310,18 @@ sal_Bool SAL_CALL osl_psz_getProfileName(const sal_Char* pszPath, const sal_Char { sal_Char *pChr=0; const sal_Char *pStr=0; - sal_Char Home[PATH_MAX] = ""; - sal_Char Config[PATH_MAX] = ""; - sal_Char Path[PATH_MAX] = ""; - sal_Char File[PATH_MAX] = ""; + sal_Char Home[PATH_MAX]; + sal_Char Config[PATH_MAX]; + sal_Char Path[PATH_MAX]; + sal_Char File[PATH_MAX]; sal_Bool bFailed; sal_Bool bHidden = sal_False; oslSecurity security; + Home[0] = '\0'; + Config[0] = '\0'; + Path[0] = '\0'; + File[0] = '\0'; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_getProfileName\n"); @@ -1378,8 +1388,11 @@ sal_Bool SAL_CALL osl_psz_getProfileName(const sal_Char* pszPath, const sal_Char /* build directory path */ if (pszPath) { - sal_Char Dir[PATH_MAX] = ""; - sal_Char Loc[PATH_MAX] = ""; + sal_Char Dir[PATH_MAX]; + sal_Char Loc[PATH_MAX]; + + Dir[0] = '\0'; + Loc[0] = '\0'; if ((strncmp(pszPath, STR_INI_METAHOME, sizeof(STR_INI_METAHOME) - 1) == 0) && ((pszPath[sizeof(STR_INI_METAHOME) - 1] == '\0') || @@ -2414,9 +2427,11 @@ static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl* pProfile) { osl_TFile* pFile=0; sal_Char* pszExtension = "tmp"; - sal_Char pszTmpName[PATH_MAX] = ""; + sal_Char pszTmpName[PATH_MAX]; oslProfileOption PFlags=0; + pszTmpName[0] = '\0'; + /* generate tmp profilename */ osl_ProfileGenerateExtension(pProfile->m_FileName,pszExtension,pszTmpName); @@ -2442,9 +2457,13 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile) { sal_Bool bRet = sal_False; - sal_Char pszBakFile[PATH_MAX] = ""; - sal_Char pszTmpFile[PATH_MAX] = ""; - sal_Char pszIniFile[PATH_MAX] = ""; + sal_Char pszBakFile[PATH_MAX]; + sal_Char pszTmpFile[PATH_MAX]; + sal_Char pszIniFile[PATH_MAX]; + + pszBakFile[0] = '\0'; + pszTmpFile[0] = '\0'; + pszIniFile[0] = '\0'; osl_ProfileGenerateExtension(pProfile->m_FileName,"bak",pszBakFile); @@ -2600,9 +2619,13 @@ static sal_Bool releaseProfile(osl_TProfileImpl* pProfile) static sal_Bool lookupProfile(const sal_Char *pszPath, const sal_Char *pszFile, sal_Char *pPath) { sal_Char *pChr, *pStr; - sal_Char Path[PATH_MAX] = ""; - sal_Char Product[132] = ""; - sal_Char Buffer[1024] = ""; + sal_Char Path[PATH_MAX]; + sal_Char Product[132]; + sal_Char Buffer[1024]; + + Path[0] = '\0'; + Product[0] = '\0'; + Buffer[0] = '\0'; if (*pszPath == '"') { @@ -2628,10 +2651,13 @@ static sal_Bool lookupProfile(const sal_Char *pszPath, const sal_Char *pszFile, /* if we have no product identification, do a special handling for soffice.ini */ if (strcasecmp(SVERSION_PROFILE, pszFile) == 0) { - sal_Char Profile[PATH_MAX] = ""; - sal_Char Dir[PATH_MAX] = ""; + sal_Char Profile[PATH_MAX]; + sal_Char Dir[PATH_MAX]; oslProfile hProfile; + Profile[0] = '\0'; + Dir[0] = '\0'; + /* open sversionrc in the system directory, and try to locate the entry with the highest version for StarOffice */ if ((osl_psz_getProfileName(SVERSION_FALLBACK, SVERSION_NAME, Profile, sizeof(Profile))) && @@ -2806,9 +2832,11 @@ static sal_Bool lookupProfile(const sal_Char *pszPath, const sal_Char *pszFile, if ((access(Path, 0) < 0) && (strlen(Product) > 0)) { - sal_Char Profile[PATH_MAX] = ""; + sal_Char Profile[PATH_MAX]; oslProfile hProfile; + Profile[0] = '\0'; + /* remove appended filename */ *pChr = '\0'; diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c index fab2bb95f46f..a7be03b82db1 100644 --- a/sal/osl/unx/security.c +++ b/sal/osl/unx/security.c @@ -2,9 +2,9 @@ * * $RCSfile: security.c,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mfe $ $Date: 2000-10-31 15:29:54 $ + * last change: $Author: mfe $ $Date: 2001-02-26 16:17:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -759,11 +759,13 @@ osl_psz_loginUser(const sal_Char* pszUserName, const sal_Char* pszPasswd, { /* only root is able to read the /etc/shadow passwd, * a normal user even can't read his own encrypted passwd */ - sal_Char buffer[ 1024 ] = ""; + sal_Char buffer[ 1024 ]; struct spwd result_buf; struct spwd *pShadowPasswd=0; int nRet=0; + buffer[0] = '\0'; + /* mfe: here we try to get the shadowpassword though it's used later */ nRet=getspnam_r ( pszUserName, &result_buf, buffer, sizeof(buffer), &pShadowPasswd); /* right password ? */ @@ -852,10 +854,12 @@ osl_psz_loginUser(const sal_Char* pszUserName, const sal_Char* pszPasswd, struct passwd* pPasswd; struct spwd spwdStruct; - sal_Char buffer[PASSWD_BUFFER_SIZE] = ""; + sal_Char buffer[PASSWD_BUFFER_SIZE]; oslSecurityImpl* pSecImpl = NULL; + buffer[0] = '\0'; + if ((pszUserName == NULL) || (pszPasswd == NULL) || (pSecurity == NULL)) return osl_Security_E_Unknown; @@ -945,7 +949,9 @@ oslSecurityError SAL_CALL osl_psz_loginUserOnFileServer( const sal_Char* pszUse sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **ustrIdent) { sal_Bool bRet=sal_False; - sal_Char pszIdent[1024] = ""; + sal_Char pszIdent[1024]; + + pszIdent[0] = '\0'; bRet = osl_psz_getUserIdent(Security,pszIdent,sizeof(pszIdent)); @@ -957,10 +963,13 @@ sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **ustrIdent sal_Bool SAL_CALL osl_psz_getUserIdent(oslSecurity Security, sal_Char *pszIdent, sal_uInt32 nMax) { - sal_Char buffer[32] = ""; + sal_Char buffer[32]; oslSecurityImpl *pSecImpl = (oslSecurityImpl *)Security; + buffer[0] = '\0'; + + if (pSecImpl == NULL) return sal_False; @@ -974,7 +983,9 @@ sal_Bool SAL_CALL osl_psz_getUserIdent(oslSecurity Security, sal_Char *pszIdent, sal_Bool SAL_CALL osl_getUserName(oslSecurity Security, rtl_uString **ustrName) { sal_Bool bRet=sal_False; - sal_Char pszName[1024] = ""; + sal_Char pszName[1024]; + + pszName[0] = '\0'; bRet = osl_psz_getUserName(Security,pszName,sizeof(pszName)); @@ -1000,8 +1011,11 @@ sal_Bool SAL_CALL osl_psz_getUserName(oslSecurity Security, sal_Char* pszName, s sal_Bool SAL_CALL osl_getHomeDir(oslSecurity Security, rtl_uString **ustrDirectory) { sal_Bool bRet=sal_False; - sal_Char pszDirectory[PATH_MAX] = ""; - sal_Char pszUncPath[PATH_MAX+4] = ""; + sal_Char pszDirectory[PATH_MAX]; + sal_Char pszUncPath[PATH_MAX+4]; + + pszDirectory[0] = '\0'; + pszUncPath[0] = '\0'; bRet = osl_psz_getHomeDir(Security,pszDirectory,sizeof(pszDirectory)); @@ -1046,8 +1060,11 @@ sal_Bool SAL_CALL osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszDirector sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString **ustrDirectory) { sal_Bool bRet = sal_False; - sal_Char pszDirectory[PATH_MAX] = ""; - sal_Char pszUncPath[PATH_MAX+4] = ""; + sal_Char pszDirectory[PATH_MAX]; + sal_Char pszUncPath[PATH_MAX+4]; + + pszDirectory[0] = '\0'; + pszUncPath[0] = '\0'; bRet = osl_psz_getConfigDir(Security,pszDirectory,sizeof(pszDirectory)); |