summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2022-05-04 09:20:01 +0200
committerLubomir Rintel <lkundrak@v3.sk>2022-06-15 12:13:26 +0200
commit47eaf963e31dca8e82d6d9c9454c000528fe5fa7 (patch)
treeeb1067efc480dcca7a96e1b498b21e844dc0b1cc
parent5f9d2927ed0246ac699e45c887b1d53dbf8f4610 (diff)
downloadNetworkManager-47eaf963e31dca8e82d6d9c9454c000528fe5fa7.tar.gz
nmcli: be less insistant on exiting when readline() gets no input
When the input ends, we indeed eventually want to shut down. Nevertheless, it might be that we terminated the input *because* we're already shutting down and want do do our cleanup. Let's not take the shortcut to nmc_exit() in case the main loop is no longer running. This doesn't affect existing uses of nmc_readline(), but will be useful in a future patch.
-rw-r--r--src/nmcli/common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nmcli/common.c b/src/nmcli/common.c
index 710914e211..fa6d1caad8 100644
--- a/src/nmcli/common.c
+++ b/src/nmcli/common.c
@@ -929,7 +929,8 @@ read_again:
}
} else if (!rl_string) {
/* Ctrl-D, exit */
- nmc_exit();
+ if (g_main_loop_is_running(loop))
+ nmc_exit();
}
/* Return NULL, not empty string */