Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
examples/libvirt.php | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/examples/libvirt.php b/examples/libvirt.php
index c30f06a..96aac6e 100644
--- a/examples/libvirt.php
+++ b/examples/libvirt.php
@@ -502,12 +502,13 @@ class Libvirt {
}
function translate_perms($mode) {
- $mode = (string)((int)$mode);
+ $mode = (int)$mode;
$tmp = '---------';
- for ($i = 0; $i < 3; $i++) {
- $bits = (int)$mode[$i];
+ for ($i = 2; $i >=0 ; $i--) {
+ $bits = $mode % 10;
+ $mode /= 10;
if ($bits & 4)
$tmp[ ($i * 3) ] = 'r';
if ($bits & 2)
--
2.8.4