wine/dlls ntdll/file.c kernel/tests/pipe.c

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 14 09:11:11 CST 2005


ChangeSet ID:	21260
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/14 09:11:11

Modified files:
	dlls/ntdll     : file.c 
	dlls/kernel/tests: pipe.c 

Log message:
	Eric Pouech <eric.pouech at wanadoo.fr>
	NtReadFile: now returning correct status in NtReadFile for EOF
	conditions (on files) and broken pipe (on named pipes).

Patch: http://cvs.winehq.org/patch.py?id=21260

Old revision  New revision  Changes     Path
 1.103         1.104         +9 -1       wine/dlls/ntdll/file.c
 1.21          1.22          +1 -1       wine/dlls/kernel/tests/pipe.c

Index: wine/dlls/ntdll/file.c
diff -u -p wine/dlls/ntdll/file.c:1.103 wine/dlls/ntdll/file.c:1.104
--- wine/dlls/ntdll/file.c:1.103	14 Nov 2005 15:11:11 -0000
+++ wine/dlls/ntdll/file.c	14 Nov 2005 15:11:11 -0000
@@ -589,8 +589,16 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile,
         else io_status->u.Status = FILE_GetNtStatus();
 	break;
     }
+    if (io_status->u.Status == STATUS_SUCCESS && io_status->Information == 0)
+    {
+        struct stat st;
+        if (fstat( unix_handle, &st ) != -1 && S_ISSOCK( st.st_mode ))
+            io_status->u.Status = STATUS_PIPE_BROKEN;
+        else
+            io_status->u.Status = STATUS_END_OF_FILE;
+    }
     wine_server_release_fd( hFile, unix_handle );
-    TRACE("= 0x%08lx\n", io_status->u.Status);
+    TRACE("= 0x%08lx (%lu)\n", io_status->u.Status, io_status->Information);
     return io_status->u.Status;
 }
 
Index: wine/dlls/kernel/tests/pipe.c
diff -u -p wine/dlls/kernel/tests/pipe.c:1.21 wine/dlls/kernel/tests/pipe.c:1.22
--- wine/dlls/kernel/tests/pipe.c:1.21	14 Nov 2005 15:11:11 -0000
+++ wine/dlls/kernel/tests/pipe.c	14 Nov 2005 15:11:11 -0000
@@ -757,7 +757,7 @@ static void test_CreatePipe(void)
     ok(ReadFile(piperead,readbuf,sizeof(readbuf),&read, NULL), "Read from broken pipe withe with pending data failed\n");
     ok(read == sizeof(PIPENAME), "Read from  anonymous pipe got %ld bytes instead of %d\n", read, sizeof(PIPENAME));
     /* But now we need to get informed that the pipe is closed */
-    todo_wine ok(ReadFile(piperead,readbuf,sizeof(readbuf),&read, NULL) == 0, "Broken pipe not detected\n");
+    ok(ReadFile(piperead,readbuf,sizeof(readbuf),&read, NULL) == 0, "Broken pipe not detected\n");
 }
 
 START_TEST(pipe)



More information about the wine-cvs mailing list