------------------------------------------------------------ revno: 11716 revision-id: squid3@treenet.co.nz-20121129111711-5o2lx5x0szipnz2u parent: squid3@treenet.co.nz-20121129111629-i146yp9xwb8ksuw3 committer: Amos Jeffries branch nick: 3.2 timestamp: Thu 2012-11-29 04:17:11 -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-20121129111711-5o2lx5x0szipnz2u # target_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # testament_sha1: 8647137cb7388d5ef2c530c1b123c78b7cb1bdac # timestamp: 2012-11-29 11:22:01 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # base_revision_id: squid3@treenet.co.nz-20121129111629-\ # i146yp9xwb8ksuw3 # # Begin patch === modified file 'src/DiskIO/DiskDaemon/DiskdIOStrategy.cc' --- src/DiskIO/DiskDaemon/DiskdIOStrategy.cc 2012-07-28 05:38:50 +0000 +++ src/DiskIO/DiskDaemon/DiskdIOStrategy.cc 2012-11-29 11:17:11 +0000 @@ -405,7 +405,8 @@ } else { debugs(79, 1, "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-07-28 05:38:50 +0000 +++ src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc 2012-11-29 11:17:11 +0000 @@ -356,7 +356,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-07-28 05:38:50 +0000 +++ tools/purge/purge.cc 2012-11-29 11:17:11 +0000 @@ -498,7 +498,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; @@ -636,13 +637,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;