X-Git-Url: https://git.distorted.org.uk/~mdw/sw-tools/blobdiff_plain/65eb98997977ba66bf96aff5e0cc8494ea03cdce..165b3d5cd16b4c9995916ea40eea9efe3ae9c93e:/src/sw_rsh.c diff --git a/src/sw_rsh.c b/src/sw_rsh.c index 785da7d..e054351 100644 --- a/src/sw_rsh.c +++ b/src/sw_rsh.c @@ -396,7 +396,7 @@ static void remote(sw_remote *r, const char *cmd, char *argv[], char *env[]) sym_table t; sym_create(&t); env_import(&t, env); - if (env != environ) { + if (env[0] && env != environ) { free(env); env_import(&t, environ); } @@ -538,7 +538,15 @@ void swrsh_remote(const char *cmd) r.fdin = 0; r.fdout = 1; - /* --- Read packets from the remote host --- */ + /* --- Object if stdin is a terminal --- */ + + if (isatty(STDIN_FILENO)) { + die(EXIT_FAILURE, + "don't use the `--remote' option unless " + "you know what you're doing."); + } + + /* --- Read packets from the remote host --- */ for (;;) { int t = pkrecv(&r);