[asan] fix some more format warnings in sysinfo/sysinfo.cc

llvm-svn: 146526
This commit is contained in:
Kostya Serebryany 2011-12-13 23:34:59 +00:00
parent 96ed5b6b47
commit 1d337a5e06
1 changed files with 13 additions and 8 deletions

View File

@ -322,12 +322,13 @@ bool ProcMapsIterator::NextExt(uint64 *start, uint64 *end, char **flags,
#if defined(__linux__)
// for now, assume all linuxes have the same format
if (sscanf(stext_, "%"SCNx64"-%"SCNx64" %4s %"SCNx64" %x:%x %"SCNd64" %n",
start ? start : &tmpstart,
end ? end : &tmpend,
(unsigned long long *)(start ? start : &tmpstart),
(unsigned long long *)(end ? end : &tmpend),
flags_,
offset ? offset : &tmpoffset,
(unsigned long long *)(offset ? offset : &tmpoffset),
&major, &minor,
inode ? inode : &tmpinode, &filename_offset) != 7) continue;
(unsigned long long *)(inode ? inode : &tmpinode),
&filename_offset) != 7) continue;
#elif defined(__CYGWIN__) || defined(__CYGWIN32__)
// cygwin is like linux, except the third field is the "entry point"
// rather than the offset (see format_process_maps at
@ -396,10 +397,14 @@ bool ProcMapsIterator::NextExt(uint64 *start, uint64 *end, char **flags,
uint64 tmp_anon_pages;
sscanf(backing_ptr+1, "F %"SCNx64" %"SCNd64") (A %"SCNx64" %"SCNd64")",
file_mapping ? file_mapping : &tmp_file_mapping,
file_pages ? file_pages : &tmp_file_pages,
anon_mapping ? anon_mapping : &tmp_anon_mapping,
anon_pages ? anon_pages : &tmp_anon_pages);
(unsigned long long *)(file_mapping ?
file_mapping : &tmp_file_mapping),
(unsigned long long *)(file_pages ?
file_pages : &tmp_file_pages),
(unsigned long long *)(anon_mapping
? anon_mapping : &tmp_anon_mapping),
(unsigned long long *)(anon_pages
? anon_pages : &tmp_anon_pages));
// null terminate the file name (there is a space
// before the first (.
backing_ptr[-1] = 0;