From c80ccabb0cfbdbc60a4ff4f885cd8f7d4eaed6d0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 23 Jun 2000 13:50:18 +0000 Subject: [PATCH] added --blocking-io option --- options.c | 9 ++++++++- util.c | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/options.c b/options.c index 49de44c0..6050524f 100644 --- a/options.c +++ b/options.c @@ -67,6 +67,7 @@ int delete_after=0; int only_existing=0; int max_delete=0; int ignore_errors=0; +int blocking_io=0; char *backup_suffix = BACKUP_SUFFIX; char *tmpdir = NULL; @@ -156,6 +157,7 @@ void usage(enum logcode F) rprintf(F," --address bind to the specified address\n"); rprintf(F," --config=FILE specify alternate rsyncd.conf file\n"); rprintf(F," --port=PORT specify alternate rsyncd port number\n"); + rprintf(F," --blocking-io use blocking IO for the remote shell\n"); rprintf(F," --stats give some file transfer stats\n"); rprintf(F," --progress show progress during transfer\n"); rprintf(F," --log-format=FORMAT log file transfers using specified format\n"); @@ -176,7 +178,7 @@ enum {OPT_VERSION, OPT_SUFFIX, OPT_SENDER, OPT_SERVER, OPT_EXCLUDE, OPT_COPY_UNSAFE_LINKS, OPT_SAFE_LINKS, OPT_COMPARE_DEST, OPT_LOG_FORMAT, OPT_PASSWORD_FILE, OPT_SIZE_ONLY, OPT_ADDRESS, OPT_DELETE_AFTER, OPT_EXISTING, OPT_MAX_DELETE, OPT_BACKUP_DIR, - OPT_IGNORE_ERRORS, OPT_BWLIMIT}; + OPT_IGNORE_ERRORS, OPT_BWLIMIT, OPT_BLOCKING_IO}; static char *short_options = "oblLWHpguDCtcahvqrRIxnSe:B:T:zP"; @@ -234,6 +236,7 @@ static struct option long_options[] = { {"partial", 0, 0, OPT_PARTIAL}, {"delete-after",0, 0, OPT_DELETE_AFTER}, {"ignore-errors",0, 0, OPT_IGNORE_ERRORS}, + {"blocking-io" ,0, 0, OPT_BLOCKING_IO}, {"config", 1, 0, OPT_CONFIG}, {"port", 1, 0, OPT_PORT}, {"log-format", 1, 0, OPT_LOG_FORMAT}, @@ -539,6 +542,10 @@ int parse_arguments(int argc, char *argv[], int frommain) ignore_errors = 1; break; + case OPT_BLOCKING_IO: + blocking_io = 1; + break; + case 'P': do_progress = 1; keep_partial = 1; diff --git a/util.c b/util.c index 7c589b37..e4ebd254 100644 --- a/util.c +++ b/util.c @@ -88,6 +88,7 @@ int piped_child(char **command,int *f_in,int *f_out) int pid; int to_child_pipe[2]; int from_child_pipe[2]; + extern int blocking_io; if (fd_pair(to_child_pipe) < 0 || fd_pair(from_child_pipe) < 0) { @@ -116,6 +117,9 @@ int piped_child(char **command,int *f_in,int *f_out) if (from_child_pipe[1] != STDOUT_FILENO) close(from_child_pipe[1]); umask(orig_umask); set_blocking(STDIN_FILENO); + if (blocking_io) { + set_blocking(STDOUT_FILENO); + } execvp(command[0], command); rprintf(FERROR,"Failed to exec %s : %s\n", command[0],strerror(errno)); -- 2.34.1