Skip to content
Browse files

Fix bugs

  • Loading branch information...
1 parent 3424aff commit 2ac2f72b39f2e4772aa64c80ed648019b33ce5d5 @lattera committed Oct 16, 2013
Showing with 24 additions and 8 deletions.
  1. +6 −6 classes/Jail.php
  2. +18 −2 classes/Mount.php
View
12 classes/Jail.php
@@ -349,19 +349,19 @@ public function Start() {
return $this->ungraceful_stop();
}
- foreach ($this->network as $n)
- if ($n->ipv6)
- exec("/usr/local/bin/sudo /usr/sbin/jexec \"{$this->name}\" /sbin/ifconfig {$n->device}b inet6 -ifdisabled");
-
exec("/usr/local/bin/sudo /usr/sbin/jexec \"{$this->name}\" /sbin/ifconfig lo0 inet 127.0.0.1");
$output = array();
- exec("/usr/local/bin/sudo /usr/sbin/jexec \"{$this->name}\" /bin/sh /etc/rc", $output, $res);
+ exec("/usr/local/bin/sudo /usr/sbin/jexec \"{$this->name}\" /bin/sh /etc/rc 2>&1", $output, $res);
if ($res != 0) {
- watchdog("jailadmin", "The rc script failed for @jail", array("@jail" => $this->name), WATCHDOG_ERROR);
+ watchdog("jailadmin", "The rc script failed for @jail: @output", array("@jail" => $this->name, "@output" => $output), WATCHDOG_ERROR);
return $this->ungraceful_stop();
}
+ foreach ($this->network as $n)
+ if ($n->ipv6)
+ exec("/usr/local/bin/sudo /usr/sbin/jexec \"{$this->name}\" /sbin/ifconfig {$n->device}b inet6 -ifdisabled");
+
watchdog("jailadmin", "Jail @jail started", array("@jail" => $this->name), WATCHDOG_INFO);
return TRUE;
View
20 classes/Mount.php
@@ -45,15 +45,31 @@ public function DoMount() {
if (!is_dir("{$this->jail->path}/{$this->target}")) {
$output = array();
+ $res = 0;
exec("/usr/local/bin/sudo /bin/mkdir -p '{$this->jail->path}/{$this->target}'", $output, $res);
- if ($res != 0)
+ if ($res != 0) {
+ watchdog("jailadmin", "Creation of mountpoint @mount in jail @jail: @reason", array(
+ "@jail" => $this->jail->name,
+ "@mount" => "{$this->jail->path}{$this->target}",
+ "@reason" => var_export($output, TRUE)
+ ), WATCHDOG_ERROR);
+
return FALSE;
+ }
}
$output = array();
+ $res = 0;
exec("{$command} {$this->source} {$this->jail->path}/{$this->target}", $output, $res);
- if ($res != 0)
+ if ($res != 0) {
+ watchdog("jailadmin", "Failed mounting @mount in jail @jail: @reason", array(
+ "@jail" => $this->jail->name,
+ "@mount" => $this->target,
+ "@reason" => var_export($output, TRUE)
+ ), WATCHDOG_ERROR);
+
return FALSE;
+ }
watchdog("jailadmin", "Mounted @mount in jail @jail", array(
"@mount" => $this->target,

0 comments on commit 2ac2f72

Please sign in to comment.
Something went wrong with that request. Please try again.