diff options
author | okan | 2015-06-29 14:24:40 +0000 |
---|---|---|
committer | okan | 2015-06-29 14:24:40 +0000 |
commit | 79f3790d536892405f9d37da7aba126fc69ceb18 (patch) | |
tree | 818f2241e1214102077952d458562c64900aa78b | |
parent | e5584ce8445fd2d2ce4d422de588ad2744321bf1 (diff) | |
download | cwm-79f3790d536892405f9d37da7aba126fc69ceb18.tar.gz |
Shuffle code in kbfunc_ssh so that a missing known_hosts file still
allows a (now blank) menu to appear, as opposed to nothing at all.
Behavior reported by Alex Greif.
-rw-r--r-- | kbfunc.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: kbfunc.c,v 1.108 2015/06/26 17:17:46 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.109 2015/06/29 14:24:40 okan Exp $ */ #include <sys/types.h> @@ -329,18 +329,17 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg) int l; size_t len; - if ((fp = fopen(Conf.known_hosts, "r")) == NULL) { - warn("kbfunc_ssh: %s", Conf.known_hosts); - return; - } - TAILQ_FOREACH(cmd, &Conf.cmdq, entry) { if (strcmp(cmd->name, "term") == 0) break; } - TAILQ_INIT(&menuq); + if ((fp = fopen(Conf.known_hosts, "r")) == NULL) { + warn("kbfunc_ssh: %s", Conf.known_hosts); + goto menu; + } + lbuf = NULL; while ((buf = fgetln(fp, &len))) { if (buf[len - 1] == '\n') @@ -366,7 +365,7 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg) } free(lbuf); (void)fclose(fp); - +menu: if ((mi = menu_filter(sc, &menuq, "ssh", NULL, CWM_MENU_DUMMY, search_match_exec, NULL)) != NULL) { if (mi->text[0] == '\0') |