File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ let name = "networkd_db"
2020let _ =
2121 let bridge = ref " " in
2222 let iface = ref " " in
23+ let rc = ref 0 in
2324 Arg. parse (Arg. align [
2425 " -bridge" , Arg. Set_string bridge, " Bridge name" ;
2526 " -iface" , Arg. Set_string iface, " Interface name" ;
@@ -34,9 +35,10 @@ let _ =
3435 let bridge_config = List. assoc ! bridge config.bridge_config in
3536 let ifaces = List. flatten (List. map (fun (_ , port ) -> port.interfaces) bridge_config.ports) in
3637 Printf. printf " interfaces=%s\n " (String. concat " ," ifaces)
37- end else
38- print_endline (" Could not find bridge " ^ ! bridge);
39-
38+ end else begin
39+ rc := 1 ;
40+ Printf. fprintf stderr " Could not find bridge %s\n " ! bridge;
41+ end ;
4042 if ! iface <> " " then
4143 if List. mem_assoc ! iface config.interface_config then begin
4244 let interface_config = List. assoc ! iface config.interface_config in
@@ -92,8 +94,10 @@ let _ =
9294 in
9395 let data = datav4 @ datav6 in
9496 List. iter (fun (k , v ) -> Printf. printf " %s=%s\n " k v) data
95- end else
96- print_endline (" Could not find interface " ^ ! iface);
97+ end else begin
98+ rc := 1 ;
99+ Printf. fprintf stderr " Could not find interface %s\n " ! iface;
100+ end ;
97101 with Network_config. Read_error ->
98- print_endline ( " Failed to read " ^ name)
99-
102+ Printf. fprintf stderr " Failed to read %s \n " name;
103+ exit ! rc;
You can’t perform that action at this time.
0 commit comments