]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/functions/functions.ports
ports: Cannot delete a port that does not exist
[people/ms/network.git] / 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}