comparison src/nt.c @ 432:3a7e78e1142d r21-2-24

Import from CVS: tag r21-2-24
author cvs
date Mon, 13 Aug 2007 11:29:58 +0200
parents a5df635868b2
children 080151679be2
comparison
equal deleted inserted replaced
431:a97165e56215 432:3a7e78e1142d
1313 return hashval (p); 1313 return hashval (p);
1314 } 1314 }
1315 1315
1316 #endif 1316 #endif
1317 1317
1318 /* Since stat is encapsulated on Windows NT, we need to encapsulate
1319 the equally broken fstat as well. */
1320 int
1321 fstat (int handle, struct stat *buffer)
1322 {
1323 int ret;
1324 BY_HANDLE_FILE_INFORMATION lpFileInfo;
1325 /* Initialize values */
1326 buffer->st_mode = 0;
1327 buffer->st_size = 0;
1328 buffer->st_dev = 0;
1329 buffer->st_rdev = 0;
1330 buffer->st_atime = 0;
1331 buffer->st_ctime = 0;
1332 buffer->st_mtime = 0;
1333 buffer->st_nlink = 0;
1334 ret = GetFileInformationByHandle((HANDLE) handle, &lpFileInfo);
1335 if (!ret)
1336 {
1337 return -1;
1338 }
1339 else
1340 {
1341 buffer->st_mtime = convert_time (lpFileInfo.ftLastWriteTime);
1342 buffer->st_atime = convert_time (lpFileInfo.ftLastAccessTime);
1343 if (buffer->st_atime == 0) buffer->st_atime = buffer->st_mtime;
1344 buffer->st_ctime = convert_time (lpFileInfo.ftCreationTime);
1345 if (buffer->st_ctime == 0) buffer->st_ctime = buffer->st_mtime;
1346 buffer->st_size = lpFileInfo.nFileSizeLow;
1347 buffer->st_nlink = (short) lpFileInfo.nNumberOfLinks;
1348 return 0;
1349 }
1350 }
1351
1318 /* MSVC stat function can't cope with UNC names and has other bugs, so 1352 /* MSVC stat function can't cope with UNC names and has other bugs, so
1319 replace it with our own. This also allows us to calculate consistent 1353 replace it with our own. This also allows us to calculate consistent
1320 inode values without hacks in the main Emacs code. */ 1354 inode values without hacks in the main Emacs code. */
1321 int 1355 int
1322 stat (const char * path, struct stat * buf) 1356 stat (const char * path, struct stat * buf)