@matheusbsbs / matheus-bagliano / commits / 8252df6218
Fork 0

mingw: remove use of _getdrive() from lstat/fstat

The field device is not used by Git, and putting the number of the current device is meaningless anyway. Signed-off-by: Dmitry Potapov <dpotapov@gmail.com> Acked-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Dmitry Potapov committed Sep 27, 2008 at 12:39 UTC 8252df62187e7fd35543552ffeab1e1eb048b57e
1 file changed +2 -3
compat/mingw.c
+2 -3
@@ -31,7 +31,6 @@ static inline time_t filetime_to_time_t(const FILETIME *ft)
31 return (time_t)winTime;
32 }
33
34 -extern int _getdrive( void );
34 /* We keep the do_lstat code in a separate function to avoid recursion.
35 * When a path ends with a slash, the stat will fail with ENOENT. In
36 * this case, we strip the trailing slashes and stat again.
@@ -55,7 +54,7 @@ static int do_lstat(const char *file_name, struct stat *buf)
54 buf->st_nlink = 1;
55 buf->st_mode = fMode;
56 buf->st_size = fdata.nFileSizeLow; /* Can't use nFileSizeHigh, since it's not a stat64 */
58 - buf->st_dev = buf->st_rdev = (_getdrive() - 1);
57 + buf->st_dev = buf->st_rdev = 0; /* not used by Git */
58 buf->st_atime = filetime_to_time_t(&(fdata.ftLastAccessTime));
59 buf->st_mtime = filetime_to_time_t(&(fdata.ftLastWriteTime));
60 buf->st_ctime = filetime_to_time_t(&(fdata.ftCreationTime));
@@ -145,7 +144,7 @@ int mingw_fstat(int fd, struct stat *buf)
144 buf->st_nlink = 1;
145 buf->st_mode = fMode;
146 buf->st_size = fdata.nFileSizeLow; /* Can't use nFileSizeHigh, since it's not a stat64 */
148 - buf->st_dev = buf->st_rdev = (_getdrive() - 1);
147 + buf->st_dev = buf->st_rdev = 0; /* not used by Git */
148 buf->st_atime = filetime_to_time_t(&(fdata.ftLastAccessTime));
149 buf->st_mtime = filetime_to_time_t(&(fdata.ftLastWriteTime));
150 buf->st_ctime = filetime_to_time_t(&(fdata.ftCreationTime));