mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 08:45:27 +00:00
config.pl get: don't rewrite config.h; detect write errors
scripts/config.pl would always rewrite config.h if it was reading it. This commit changes it to not modify the file when only reading is required, i.e. for the get command. Also, die if writing config.h fails (e.g. disk full).
This commit is contained in:
parent
134a082455
commit
58e5fdc0ca
|
@ -175,7 +175,10 @@ if ($action eq "realfull") {
|
|||
$no_exclude_re = join '|', @non_excluded;
|
||||
}
|
||||
|
||||
open my $config_write, '>', $config_file or die "write $config_file: $!\n";
|
||||
my $config_write = undef;
|
||||
if ($action ne "get") {
|
||||
open $config_write, '>', $config_file or die "write $config_file: $!\n";
|
||||
}
|
||||
|
||||
my $done;
|
||||
for my $line (@config_lines) {
|
||||
|
@ -211,7 +214,9 @@ for my $line (@config_lines) {
|
|||
}
|
||||
}
|
||||
|
||||
print $config_write $line;
|
||||
if (defined $config_write) {
|
||||
print $config_write $line or die "write $config_file: $!\n";;
|
||||
}
|
||||
}
|
||||
|
||||
# Did the set command work?
|
||||
|
@ -223,10 +228,12 @@ if ($action eq "set"&& $force_option && !$done) {
|
|||
$line .= "\n";
|
||||
$done = 1;
|
||||
|
||||
print $config_write $line;
|
||||
print $config_write $line or die "write $config_file: $!\n";
|
||||
}
|
||||
|
||||
close $config_write;
|
||||
if (defined $config_write) {
|
||||
close $config_write or die "close $config_file: $!\n";
|
||||
}
|
||||
|
||||
if ($action eq "get") {
|
||||
if($done) {
|
||||
|
|
Loading…
Reference in a new issue