Aric Stewart : ntdll: Fix parsing of proc file. Also correct memory deallocation on the Mac.
Alexandre Julliard
julliard at winehq.org
Mon Nov 3 09:06:55 CST 2008
Module: wine
Branch: master
Commit: 1865c47ff8b39b475271866bed832c78e6ba4e23
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1865c47ff8b39b475271866bed832c78e6ba4e23
Author: Aric Stewart <aric at codeweavers.com>
Date: Fri Oct 31 15:17:17 2008 -0500
ntdll: Fix parsing of proc file. Also correct memory deallocation on the Mac.
---
dlls/ntdll/nt.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index a8365dc..5b0c0bf 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -938,7 +938,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
sppi[i].liKernelTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_SYSTEM];
sppi[i].liUserTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_USER];
}
- vm_deallocate (mach_task_self (), (vm_address_t) pinfo, info_count);
+ vm_deallocate (mach_task_self (), (vm_address_t) pinfo, info_count * sizeof(natural_t));
}
}
#else
@@ -950,10 +950,14 @@ NTSTATUS WINAPI NtQuerySystemInformation(
unsigned long idle;
int count;
char name[10];
+ char line[255];
/* first line is combined usage */
- count = fscanf(cpuinfo,"%s %u %u %u %lu",name, &usr, &nice,
+ if (fgets(line,255,cpuinfo))
+ count = sscanf(line,"%s %u %u %u %lu",name, &usr, &nice,
&sys, &idle);
+ else
+ count = 0;
/* we set this up in the for older non-smp enabled kernels */
if (count == 5 && strcmp(name,"cpu")==0)
{
@@ -968,8 +972,11 @@ NTSTATUS WINAPI NtQuerySystemInformation(
do
{
- count = fscanf(cpuinfo,"%s %u %u %u %lu",name, &usr,
+ if (fgets(line,255,cpuinfo))
+ count = sscanf(line,"%s %u %u %u %lu",name, &usr,
&nice, &sys, &idle);
+ else
+ count = 0;
if (count == 5 && strncmp(name,"cpu",3)==0)
{
out_cpus --;
More information about the wine-cvs
mailing list