1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

r10577: Fix error in ReadFile()

(This used to be commit 04b8c473d7d55d4d802631074843e43fe7d9cfea)
This commit is contained in:
Jelmer Vernooij 2005-09-28 13:55:19 +00:00 committed by Gerald (Jerry) Carter
parent 4ad69c3dee
commit ffbd9313e2

View File

@ -13,7 +13,7 @@ int main(int argc, char *argv[])
{ {
HANDLE h; HANDLE h;
DWORD numread = 0; DWORD numread = 0;
char outbuffer[512]; char *outbuffer = malloc(strlen(ECHODATA));
if (argc == 1) { if (argc == 1) {
printf("Usage: %s pipename\n", argv[0]); printf("Usage: %s pipename\n", argv[0]);
@ -27,12 +27,12 @@ int main(int argc, char *argv[])
return -1; return -1;
} }
if (!WriteFile(h, ECHODATA, strlen(ECHODATA), NULL, NULL)) { if (!WriteFile(h, ECHODATA, strlen(ECHODATA), &numread, NULL)) {
printf("Error writing: %d\n", GetLastError()); printf("Error writing: %d\n", GetLastError());
return -1; return -1;
} }
if (!ReadFile(h, outbuffer, strlen(ECHODATA), NULL, NULL)) { if (!ReadFile(h, outbuffer, strlen(ECHODATA), &numread, NULL)) {
printf("Error reading: %d\n", GetLastError()); printf("Error reading: %d\n", GetLastError());
return -1; return -1;
} }