fix bug that passing invalid fd to fstats on win32 builds

lfd returned by adb_open is not the actual file desc.
on win32 builds. calling through fstat with invalid fd
will lead to crash, using stat instead.

Change-Id: I7fdc8b825162eaa42efe8755265842c300b00e39
Signed-off-by: eric.yan <eric.yan@yulong.com>
Signed-off-by: severecold <severecold@gmail.com>
This commit is contained in:
eric.yan 2015-02-03 22:16:29 +08:00 committed by apachegroup .
parent 5ac8b917de
commit a859219fec
1 changed files with 1 additions and 1 deletions

View File

@ -240,7 +240,7 @@ static int write_data_file(int fd, const char *path, syncsendbuf *sbuf, int show
if (show_progress) {
// Determine local file size.
struct stat st;
if (fstat(lfd, &st)) {
if (stat(path, &st)) {
fprintf(stderr,"cannot stat '%s': %s\n", path, strerror(errno));
return -1;
}