From: Maynard J. <may...@us...> - 2007-11-29 18:12:39
|
Update of /cvsroot/oprofile/oprofile/libopagent In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5551/libopagent Modified Files: Tag: JIT_SUPPORT libopagent.c Log Message: fwrite pad bytes only when necessary Index: libopagent.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/libopagent/Attic/libopagent.c,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -u -p -d -r1.1.2.8 -r1.1.2.9 --- libopagent.c 29 Nov 2007 17:49:15 -0000 1.1.2.8 +++ libopagent.c 29 Nov 2007 18:12:29 -0000 1.1.2.9 @@ -105,7 +105,7 @@ int op_open_agent(unsigned int dump_code return -1; } /* write padding '\0' if necessary */ - if (!fwrite(padByte, padCnt, 1, dumpfile)) { + if (padCnt && !fwrite(padByte, padCnt, 1, dumpfile)) { perror(tmp); return -1; } @@ -170,7 +170,8 @@ int op_write_native_code(char const * sy fwrite_unlocked(symbol_name, sz_symb_name, 1, dumpfile)) { if (include_code) fwrite_unlocked(code, size, 1, dumpfile); - fwrite_unlocked(padByte, rec.cntPadBytes, 1, dumpfile); + if (rec.cntPadBytes) + fwrite_unlocked(padByte, rec.cntPadBytes, 1, dumpfile); /* Always flush to ensure conversion code to elf will see * data as soon as possible */ fflush_unlocked(dumpfile); |