summaryrefslogtreecommitdiffstats
path: root/etc/inc/util.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2012-07-30 15:07:33 -0400
committerjim-p <jimp@pfsense.org>2012-07-30 15:07:33 -0400
commita9f250d6a3372404cb7adb9c6d870eb085f566d0 (patch)
treed0ee5926cccf118dbae2937961bc17abab04a2a0 /etc/inc/util.inc
parent4b163ecef532f8aca1df315c39dfd9cd3637bc10 (diff)
downloadpfsense-a9f250d6a3372404cb7adb9c6d870eb085f566d0.zip
pfsense-a9f250d6a3372404cb7adb9c6d870eb085f566d0.tar.gz
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
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r--etc/inc/util.inc4
1 files changed, 2 insertions, 2 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index f95cdb0..565b8b7 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -200,7 +200,7 @@ function refcount_reference($reference) {
$shmid = @shmop_open($reference, "w", 0, 0);
}
$shm_data = @shmop_read($shmid, 0, 10);
- $shm_data = intval($shm_data) + 1;
+ $shm_data = str_pad(intval($shm_data) + 1, 4, "0", STR_PAD_LEFT);
@shmop_write($shmid, $shm_data, 0);
@shmop_close($shmid);
} catch (Exception $e) {
@@ -215,7 +215,7 @@ function refcount_unreference($reference) {
/* We assume that the shared memory exists. */
$shmid = @shmop_open($reference, "w", 0, 0);
$shm_data = @shmop_read($shmid, 0, 10);
- $shm_data = intval($shm_data) - 1;
+ $shm_data = str_pad(intval($shm_data) - 1, 4, "0", STR_PAD_LEFT);
if ($shm_data < 0) {
//debug_backtrace();
log_error(sprintf(gettext("Reference %s is going negative, not doing unreference."), $reference));
OpenPOWER on IntegriCloud