]> git.ipfire.org Git - people/stevee/network.git/commitdiff
header-port: Print errors if config could not be read/written
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 20 Sep 2018 21:35:58 +0000 (22:35 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 20 Sep 2018 21:35:58 +0000 (22:35 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/header-port

index 68cb62dec2e0b8f0340b171aa7402df76443471f..158a7cb7eb9b018b590b69dbbdbfc1b17c45fb0f 100644 (file)
@@ -64,13 +64,22 @@ hook_default_edit() {
        assert isset port
        shift
 
-       port_settings_read "${port}" ${HOOK_SETTINGS}
+       # Read settings
+       if ! port_settings_read "${port}" ${HOOK_SETTINGS}; then
+               error "Could not read settings for port ${port}"
+               return ${EXIT_ERROR}
+       fi
 
+       # Parse command line arguments
        if ! hook_parse_cmdline "$@"; then
                return ${EXIT_ERROR}
        fi
 
-       port_settings_write "${port}" ${HOOK_SETTINGS}
+       # Save settings
+       if ! port_settings_write "${port}" ${HOOK_SETTINGS}; then
+               error "Could not write settings for port ${port}"
+               return ${EXIT_ERROR}
+       fi
 
        return ${EXIT_OK}
 }