Changeset 42181 in vbox
- Timestamp:
- Jul 17, 2012 12:54:11 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 79180
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/generic/AutostartDb-generic.cpp
r42118 r42181 27 27 #include "AutostartDb.h" 28 28 29 /** @todo: Make configurable through kmk/installer. */30 #define AUTOSTART_DATABASE "/etc/vbox/autostart.d"31 32 29 #if defined(RT_OS_LINUX) 33 30 /** … … 38 35 * @param fAddVM Flag whether a VM is added or removed from the database. 39 36 */ 40 static intautostartModifyDb(bool fAutostart, bool fAddVM)37 int AutostartDb::autostartModifyDb(bool fAutostart, bool fAddVM) 41 38 { 42 39 int rc = VINF_SUCCESS; 43 40 char *pszUser = NULL; 41 42 /* Check if the path is set. */ 43 if (!m_pszAutostartDbPath) 44 return VERR_PATH_NOT_FOUND; 44 45 45 46 rc = RTProcQueryUsernameA(RTProcSelf(), &pszUser); … … 58 59 59 60 rc = RTStrAPrintf(&pszFile, "%s/%s.%s", 60 AUTOSTART_DATABASE, pszUser, fAutostart ? "start" : "stop");61 m_pszAutostartDbPath, pszUser, fAutostart ? "start" : "stop"); 61 62 if (RT_SUCCESS(rc)) 62 63 { … … 141 142 int rc = RTCritSectInit(&this->CritSect); 142 143 NOREF(rc); 144 m_pszAutostartDbPath = NULL; 143 145 #endif 144 146 } … … 148 150 #ifdef RT_OS_LINUX 149 151 RTCritSectDelete(&this->CritSect); 152 if (m_pszAutostartDbPath) 153 RTStrFree(m_pszAutostartDbPath); 154 #endif 155 } 156 157 int AutostartDb::setAutostartDbPath(const char *pszAutostartDbPathNew) 158 { 159 #if defined(RT_OS_LINUX) 160 char *pszAutostartDbPathTmp = NULL; 161 162 if (pszAutostartDbPathNew) 163 { 164 pszAutostartDbPathTmp = RTStrDup(pszAutostartDbPathNew); 165 if (!pszAutostartDbPathTmp) 166 return VERR_NO_MEMORY; 167 } 168 169 RTCritSectEnter(&this->CritSect); 170 if (m_pszAutostartDbPath) 171 RTStrFree(m_pszAutostartDbPath); 172 173 m_pszAutostartDbPath = pszAutostartDbPathTmp; 174 RTCritSectLeave(&this->CritSect); 175 return VINF_SUCCESS; 176 #else 177 NOREF(pszAutostartDbPathNew); 178 return VERR_NOT_SUPPORTED 150 179 #endif 151 180 }
Note:
See TracChangeset
for help on using the changeset viewer.