Skip to content

Commit 8252df6

Browse files
dmpotspearce
authored andcommitted
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>
1 parent d317851 commit 8252df6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

compat/mingw.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ static inline time_t filetime_to_time_t(const FILETIME *ft)
3131
return (time_t)winTime;
3232
}
3333

34-
extern int _getdrive( void );
3534
/* We keep the do_lstat code in a separate function to avoid recursion.
3635
* When a path ends with a slash, the stat will fail with ENOENT. In
3736
* 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)
5554
buf->st_nlink = 1;
5655
buf->st_mode = fMode;
5756
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 */
5958
buf->st_atime = filetime_to_time_t(&(fdata.ftLastAccessTime));
6059
buf->st_mtime = filetime_to_time_t(&(fdata.ftLastWriteTime));
6160
buf->st_ctime = filetime_to_time_t(&(fdata.ftCreationTime));
@@ -145,7 +144,7 @@ int mingw_fstat(int fd, struct stat *buf)
145144
buf->st_nlink = 1;
146145
buf->st_mode = fMode;
147146
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 */
149148
buf->st_atime = filetime_to_time_t(&(fdata.ftLastAccessTime));
150149
buf->st_mtime = filetime_to_time_t(&(fdata.ftLastWriteTime));
151150
buf->st_ctime = filetime_to_time_t(&(fdata.ftCreationTime));

0 commit comments

Comments
 (0)