[2/3] IPsec: Do not interpret $? as error code of move()
Commit Message
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
html/cgi-bin/vpnmain.cgi | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
> ---
> html/cgi-bin/vpnmain.cgi | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi
> index 980601ba0..e9064e19c 100644
> --- a/html/cgi-bin/vpnmain.cgi
> +++ b/html/cgi-bin/vpnmain.cgi
> @@ -2042,9 +2042,8 @@ END
> unlink ($filename);
> goto VPNCONF_ERROR;
> } else {
> - move($filename,
> "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem");
> - if ($? ne 0) {
> - $errormessage =
> "$Lang::tr{'certificate file move failed'}: $!";
> + unless (move($filename,
> "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem")) {
> + $errormessage =
> "$Lang::tr{'certificate file move failed'} ($filename): $!";
> unlink ($filename);
> goto VPNCONF_ERROR;
> }
@@ -2042,9 +2042,8 @@ END
unlink ($filename);
goto VPNCONF_ERROR;
} else {
- move($filename, "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem");
- if ($? ne 0) {
- $errormessage = "$Lang::tr{'certificate file move failed'}: $!";
+ unless (move($filename, "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem")) {
+ $errormessage = "$Lang::tr{'certificate file move failed'} ($filename): $!";
unlink ($filename);
goto VPNCONF_ERROR;
}