diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-10-13 13:11:06 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-10-13 13:11:06 +0000 |
commit | 760e39e405fc5b31432989df146b21bb8b78c205 (patch) | |
tree | 2d81d1c56deefe3c5417e4b9e811ed19f3932755 | |
parent | 5d78371628a719d5d1f0e5a0ecc99b885f4e7d15 (diff) |
Don't print exit messages when used as a login shell, requested by martynas@ a
while back.
-rw-r--r-- | client.c | 50 |
1 files changed, 28 insertions, 22 deletions
@@ -212,30 +212,36 @@ client_main(struct client_ctx *cctx) } out: - if (sigterm) { - printf("[terminated]\n"); - return (1); - } - switch (cctx->exittype) { - case CCTX_DIED: - printf("[lost server]\n"); - return (0); - case CCTX_SHUTDOWN: - printf("[server exited]\n"); - return (0); - case CCTX_EXIT: - if (cctx->errstr != NULL) { - printf("[error: %s]\n", cctx->errstr); + /* + * Print exit status message, unless running as a login shell where it + * would either be pointless or irritating. + */ + if (!login_shell) { + if (sigterm) { + printf("[terminated]\n"); + return (1); + } + switch (cctx->exittype) { + case CCTX_DIED: + printf("[lost server]\n"); + return (0); + case CCTX_SHUTDOWN: + printf("[server exited]\n"); + return (0); + case CCTX_EXIT: + if (cctx->errstr != NULL) { + printf("[error: %s]\n", cctx->errstr); + return (1); + } + printf("[exited]\n"); + return (0); + case CCTX_DETACH: + printf("[detached]\n"); + return (0); + default: + printf("[unknown error]\n"); return (1); } - printf("[exited]\n"); - return (0); - case CCTX_DETACH: - printf("[detached]\n"); - return (0); - default: - printf("[unknown error]\n"); - return (1); } } |