]> git.ipfire.org Git - people/ms/network.git/commitdiff
ports: Cannot delete a port that does not exist
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Aug 2017 21:16:20 +0000 (23:16 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Aug 2017 21:16:20 +0000 (23:16 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.ports

index 3f873c9971798861663e3a09393b79c0ec1505d5..fcb92066cadca8d728a4edaaf8d30e6135fd31f1 100644 (file)
@@ -170,10 +170,13 @@ port_new() {
 
 port_destroy() {
        local port=${1}
-
        assert isset port
 
-       port_exists ${port} || return ${EXIT_OK}
+       # Cannot delete a port that does not exist
+       if ! port_exists ${port}; then
+               error "No such port: ${port}"
+               return ${EXIT_ERROR}
+       fi
 
        # Check if the port is attached to any zone and don't delete it.
        local ok=${EXIT_OK}