From 011ba4b9bf9f0b1b1f99639f8395a76760f717c0 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Thu, 5 Apr 2018 18:09:39 -0700 Subject: [PATCH] adb: win32: properly set EBADF in some functions. Test: treehugger Change-Id: If3f29f9ee586e29652e9709b3f594a1376ed4bb3 --- adb/sysdeps_win32.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/adb/sysdeps_win32.cpp b/adb/sysdeps_win32.cpp index b5334b141..caad50bf3 100644 --- a/adb/sysdeps_win32.cpp +++ b/adb/sysdeps_win32.cpp @@ -462,6 +462,7 @@ int adb_read(int fd, void* buf, int len) { FH f = _fh_from_int(fd, __func__); if (f == NULL) { + errno = EBADF; return -1; } @@ -472,6 +473,7 @@ int adb_write(int fd, const void* buf, int len) { FH f = _fh_from_int(fd, __func__); if (f == NULL) { + errno = EBADF; return -1; } @@ -493,6 +495,7 @@ int adb_lseek(int fd, int pos, int where) { FH f = _fh_from_int(fd, __func__); if (!f) { + errno = EBADF; return -1; } @@ -503,6 +506,7 @@ int adb_close(int fd) { FH f = _fh_from_int(fd, __func__); if (!f) { + errno = EBADF; return -1; }