diff --git a/init/init-lib.pl b/init/init-lib.pl
index d62c3c441..b1e7189d0 100755
--- a/init/init-lib.pl
+++ b/init/init-lib.pl
@@ -2287,7 +2287,7 @@ foreach my $l (split(/\r?\n/, $out)) {
# Build map from plist files to agents
my @dirs = ("/Library/LaunchAgents",
- "/Library/LaunchDaemons/",
+ "/Library/LaunchDaemons",
"/System/Library/LaunchAgents",
"/System/Library/LaunchDaemons");
my %pmap;
@@ -2306,11 +2306,12 @@ foreach my $a (@rv) {
my %attrs;
foreach my $l (split(/\r?\n/, $out)) {
if ($l =~ /"(\S+)"\s*=\s*"([^"]*)";/ ||
- $l =~ /"(\S+)"\s*=\s*\S+;/) {
+ $l =~ /"(\S+)"\s*=\s*(\S+);/) {
$attrs{lc($1)} = $2;
}
}
$a->{'start'} = $attrs{'program'};
+ $a->{'boot'} = $attrs{'ondemand'} eq 'false';
$a->{'file'} = $pmap{$a->{'name'}};
}
@@ -2342,7 +2343,7 @@ $plist .= "KeepAlive\n";
$plist .= "\n";
$plist .= "\n";
$plist .= "\n";
-&open_locl_tempfile(PLIST, ">$file");
+&open_lock_tempfile(PLIST, ">$file");
&print_tempfile(PLIST, $plist);
&close_tempfile(PLIST);
my $out = &backquote_logged("launchctl load ".quotemeta($file)." 2>&1");
diff --git a/init/save_launchd.cgi b/init/save_launchd.cgi
index 753e4a2c3..e4542d08b 100755
--- a/init/save_launchd.cgi
+++ b/init/save_launchd.cgi
@@ -55,7 +55,8 @@ else {
&open_lock_tempfile(CONF, ">$u->{'file'}");
&print_tempfile(CONF, $in{'conf'});
&close_tempfile(CONF);
- &restart_launchd();
+ &system_logged("launchctl unload ".quotemeta($u->{'file'})." 2>&1");
+ &system_logged("launchctl load ".quotemeta($u->{'file'})." 2>&1");
# Enable or disable
if (defined($in{'boot'})) {