Changeset 12961 in vbox for trunk/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp
- Timestamp:
- Oct 2, 2008 9:22:56 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 37389
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp
r12908 r12961 82 82 if (fPreInited) 83 83 return VINF_SUCCESS; 84 Assert(pThis->hDevice == NIL_RTFILE); 84 85 85 86 /* … … 95 96 * Try open the device. 96 97 */ 97 pThis->hDevice = open(DEVICE_NAME, O_RDWR, 0);98 if ( (int)pThis->hDevice < 0)98 int hDevice = open(DEVICE_NAME, O_RDWR, 0); 99 if (hDevice < 0) 99 100 { 100 101 /* 101 102 * Try load the device. 102 103 */ 103 pThis->hDevice = open(DEVICE_NAME, O_RDWR, 0);104 if ( (int)pThis->hDevice < 0)104 hDevice = open(DEVICE_NAME, O_RDWR, 0); 105 if (hDevice < 0) 105 106 { 106 107 int rc; … … 122 123 * Mark the file handle close on exec. 123 124 */ 124 if (fcntl(pThis->hDevice, F_SETFD, FD_CLOEXEC) == -1) 125 { 126 close(pThis->hDevice); 127 pThis->hDevice = -1; 125 if (fcntl(hDevice, F_SETFD, FD_CLOEXEC) == -1) 126 { 127 close(hDevice); 128 128 #ifdef IN_SUP_HARDENED_R3 129 129 return VERR_INTERNAL_ERROR; … … 136 136 * We're done. 137 137 */ 138 pThis->hDevice = hDevice; 138 139 return VINF_SUCCESS; 139 140 } … … 145 146 { 146 147 /* 147 * C heck if we're initited at all.148 */ 149 if ( (int)pThis->hDevice >= 0)148 * Close the device if it's actually open. 149 */ 150 if (pThis->hDevice != NIL_RTFILE) 150 151 { 151 152 if (close(pThis->hDevice)) 152 153 AssertFailed(); 153 pThis->hDevice = -1;154 pThis->hDevice = NIL_RTFILE; 154 155 } 155 156
Note:
See TracChangeset
for help on using the changeset viewer.