------------------------------------------------------------ revno: 12403 revision-id: squid3@treenet.co.nz-20121124033847-500j6hsxl9c7xdyc parent: squid3@treenet.co.nz-20121124033806-tcr2u52oosqguv57 committer: Amos Jeffries branch nick: 3.3 timestamp: Fri 2012-11-23 20:38:47 -0700 message: Fix various assertion with side effects When compiled with high optimization and assert disabled these operations would have disappeared. The side effects being: * Disk I/O failure protection disabled. Allowing loops in diskd write. * squidpurge error handling on command line parse gone. Causing segfault. * squidpurge 'I am Alive' ticker feature cease working. Detected by Coverity Scan. Issues 740299, 740300, 740301, 740302, 740303 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20121124033847-500j6hsxl9c7xdyc # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: bc4144dfbe73fc5eb957dee77b7d26e608d1339b # timestamp: 2012-11-24 03:43:55 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20121124033806-\ # tcr2u52oosqguv57 # # Begin patch === modified file 'src/DiskIO/DiskDaemon/DiskdIOStrategy.cc' --- src/DiskIO/DiskDaemon/DiskdIOStrategy.cc 2012-09-04 09:10:20 +0000 +++ src/DiskIO/DiskDaemon/DiskdIOStrategy.cc 2012-11-24 03:38:47 +0000 @@ -401,7 +401,8 @@ } else { debugs(79, DBG_IMPORTANT, "storeDiskdSend: msgsnd: " << xstrerror()); cbdataReferenceDone(M->callback_data); - assert(++send_errors < 100); + ++send_errors; + assert(send_errors < 100); if (shm_offset > -1) shm.put(shm_offset); } === modified file 'src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc' --- src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc 2012-09-01 14:38:36 +0000 +++ src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc 2012-11-24 03:38:47 +0000 @@ -360,7 +360,8 @@ debugs(79, 3, "DiskThreadsDiskFile::writeDone: FD " << fd << ", len " << len << ", err=" << errflag); - assert(++loop_detect < 10); + ++loop_detect; + assert(loop_detect < 10); --inProgressIOs; === modified file 'tools/purge/purge.cc' --- tools/purge/purge.cc 2012-10-04 11:10:17 +0000 +++ tools/purge/purge.cc 2012-11-24 03:38:47 +0000 @@ -489,7 +489,8 @@ if ( ::iamalive ) { static char alivelist[4][3] = { "\\\b", "|\b", "/\b", "-\b" }; static unsigned short alivecount = 0; - assert( write( STDOUT_FILENO, alivelist[alivecount++ & 3], 2 ) == 2 ); + const int write_success = write(STDOUT_FILENO, alivelist[alivecount++ & 3], 2); + assert(write_success == 2); } bool flag = true; @@ -627,13 +628,15 @@ case 'C': if ( optarg && *optarg ) { if ( copydir ) xfree( (void*) copydir ); - assert( (copydir = xstrdup(optarg)) ); + copydir = xstrdup(optarg); + assert(copydir); } break; case 'c': if ( optarg && *optarg ) { - if ( *conffile ) xfree((void*) conffile ); - assert( (conffile = xstrdup(optarg)) ); + if ( *conffile ) xfree((void*) conffile); + conffile = xstrdup(optarg); + assert(conffile); } break;