Changeset 31867 in vbox
- Timestamp:
- Aug 23, 2010 3:21:58 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
r31037 r31867 36 36 # include <net/if.h> 37 37 # include <unistd.h> 38 # ifndef RT_OS_FREEBSD /* The header does not exist anymore since FreeBSD 9-current */39 # include <utmp .h>38 # ifndef RT_OS_FREEBSD 39 # include <utmpx.h> /* @todo FreeBSD 9 should have this. */ 40 40 # endif 41 41 # ifdef RT_OS_SOLARIS … … 215 215 static int vboxserviceVMInfoWriteUsers(void) 216 216 { 217 int rc ;217 int rc = VINF_SUCCESS; 218 218 char *pszUserList = NULL; 219 219 uint32_t cUsersInList = 0; … … 227 227 228 228 #elif defined(RT_OS_FREEBSD) 229 /** @todo FreeBSD: Port logged on user info retrival. */ 229 /** @todo FreeBSD: Port logged on user info retrival. 230 * However, FreeBSD 9 supports utmpx, so we could use the code 231 * block below (?). */ 230 232 rc = VERR_NOT_IMPLEMENTED; 231 233 … … 235 237 236 238 #else 237 /** @todo Add utmpx support? */ 238 rc = utmpname(UTMP_FILE); 239 # ifdef RT_OS_SOLARIS 240 if (rc != 1) 241 # else 242 if (rc != 0) 243 # endif 244 { 245 VBoxServiceError("VMInfo/Users: Could not set UTMP file! Error: %ld\n", errno); 246 rc = VERR_GENERAL_FAILURE; 247 } 248 else 249 rc = VINF_SUCCESS; 250 251 setutent(); 252 utmp *ut_user; 239 setutxent(); 240 utmpx *ut_user; 253 241 uint32_t cListSize = 32; 254 242 … … 259 247 260 248 /* Process all entries in the utmp file. */ 261 while ( (ut_user = getut ent())249 while ( (ut_user = getutxent()) 262 250 && RT_SUCCESS(rc)) 263 251 { … … 316 304 RTMemFree(papszUsers); 317 305 318 endut ent(); /* Close utmpfile. */306 endutxent(); /* Close utmpx file. */ 319 307 #endif 320 308 Assert(RT_FAILURE(rc) || cUsersInList == 0 || (pszUserList && *pszUserList));
Note:
See TracChangeset
for help on using the changeset viewer.