Changeset 26839 in vbox for trunk/src/VBox/Runtime/r3/linux
- Timestamp:
- Feb 26, 2010 12:38:55 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/linux/RTSystemQueryDmiString-linux.cpp
r26618 r26839 67 67 if (fd >= 0) 68 68 { 69 /* Note! This will return VERR_BUFFER_OVERFLOW even if there is a70 trailing newline that we don't care about. */71 69 size_t cbRead; 72 rc = RTLinuxSysFsReadFile(fd, pszBuf, cbBuf - 1, &cbRead);70 rc = RTLinuxSysFsReadFile(fd, pszBuf, cbBuf, &cbRead); 73 71 if (RT_SUCCESS(rc) || rc == VERR_BUFFER_OVERFLOW) 74 72 { 75 pszBuf[cbRead] = '\0'; 76 while (cbRead > 0 && pszBuf[cbRead - 1] == '\n') 77 pszBuf[--cbRead] = '\0'; 73 /* The file we're reading may end with a newline, remove it. */ 74 if (cbRead == cbBuf) 75 pszBuf[cbRead - 1] = '\0'; 76 else 77 { 78 AssertRC(rc); 79 pszBuf[cbRead] = '\0'; 80 if (cbRead > 0 && pszBuf[cbRead - 1] == '\n') 81 pszBuf[cbRead - 1] = '\0'; 82 } 78 83 } 79 84 RTLinuxSysFsClose(fd);
Note:
See TracChangeset
for help on using the changeset viewer.