File tree Expand file tree Collapse file tree 1 file changed +18
-18
lines changed
Expand file tree Collapse file tree 1 file changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -278,24 +278,7 @@ fn edit_sudoers_file(
278278 )
279279 } ) ?;
280280
281- if errors. is_empty ( ) {
282- if sudo_visudo_is_allowed ( sudoers, & host_name) == Some ( false ) {
283- writeln ! (
284- stderr,
285- "It looks like you have removed your ability to run 'sudo visudo' again.\n "
286- ) ?;
287- match ask_response (
288- b"What now? (p)roceed anyway / e(x)it without saving / (e)dit again: " ,
289- b"xep" ,
290- ) ? {
291- b'x' => return Ok ( ( ) ) ,
292- b'p' => { }
293- _ => continue ,
294- }
295- }
296-
297- break ;
298- } else {
281+ let true = errors. is_empty ( ) else {
299282 writeln ! ( stderr, "The provided sudoers file format is not recognized or contains syntax errors. Please review:\n " ) ?;
300283
301284 for crate :: sudoers:: Error {
@@ -314,7 +297,24 @@ fn edit_sudoers_file(
314297 b'x' => return Ok ( ( ) ) ,
315298 _ => continue ,
316299 }
300+ } ;
301+
302+ if sudo_visudo_is_allowed ( sudoers, & host_name) == Some ( false ) {
303+ writeln ! (
304+ stderr,
305+ "It looks like you have removed your ability to run 'sudo visudo' again.\n "
306+ ) ?;
307+ match ask_response (
308+ b"What now? (p)roceed anyway / e(x)it without saving / (e)dit again: " ,
309+ b"xep" ,
310+ ) ? {
311+ b'x' => return Ok ( ( ) ) ,
312+ b'p' => { }
313+ _ => continue ,
314+ }
317315 }
316+
317+ break ;
318318 }
319319
320320 let tmp_contents = std:: fs:: read ( tmp_path) ?;
You can’t perform that action at this time.
0 commit comments