Project

General

Profile

« Previous | Next » 

Revision a9f250d6

Added by Jim Pingle almost 13 years ago

Pad data when adding to refcount reference, to avoid some oddities with how php handles such data. http://forum.pfsense.org/index.php/topic,51188.msg278141.html#msg278141

View differences:

etc/inc/util.inc
200 200
			$shmid = @shmop_open($reference, "w", 0, 0);
201 201
		}
202 202
		$shm_data = @shmop_read($shmid, 0, 10);
203
		$shm_data = intval($shm_data) + 1;
203
		$shm_data = str_pad(intval($shm_data) + 1, 4, "0", STR_PAD_LEFT);
204 204
		@shmop_write($shmid, $shm_data, 0);
205 205
		@shmop_close($shmid);
206 206
	} catch (Exception $e) {
......
215 215
		/* We assume that the shared memory exists. */
216 216
		$shmid = @shmop_open($reference, "w", 0, 0);
217 217
		$shm_data = @shmop_read($shmid, 0, 10);
218
		$shm_data = intval($shm_data) - 1;
218
		$shm_data = str_pad(intval($shm_data) - 1, 4, "0", STR_PAD_LEFT);
219 219
		if ($shm_data < 0) {
220 220
			//debug_backtrace();
221 221
			log_error(sprintf(gettext("Reference %s is going negative, not doing unreference."), $reference));

Also available in: Unified diff