Igor Yu. Zhbanov wrote: > I am using rsync compiled with Cygwin on windows. > I must call rsync from the *.bat script (I don't want to use a bash on Windows) > and I have noticed that in the case when program compiled by Cygwin crashes > via segmentation fault and default SIGSEGV handler is called, then it > terminates process with exit status 0 as I see it from my *.bat script. > (But if I invoke a program from bash (compiled with Cygwin too) I will see > error code 139 as expected.) > > It is a Cygwin's problem, not an rsync's, but to use it on windows and > to distinguish situations when rsync crashes and when it exits normally, > I have written signal handler which terminates process with code 50. > You may use conventional 139. Also signal handler writes corresponding > message to log file. > > By the way. When I terminate rsync in daemon mode by pressing Control-C, > it writes an error to log. May be this is not an error but info or notice? I'm not sure I like this, but if you run into the cygwin problem, this might prove helpful. To use this patch, run these commands for a successful build: patch -p1 0) {} + int status; + while (waitpid(-1, &status, WNOHANG) > 0) { + if (WIFSIGNALED(status)) { + rprintf(FLOG, + "rsync error: (3) Child proccess has unexpectedly died with signal %d\n", + WTERMSIG(status)); + } else if (WIFEXITED(status) && WEXITSTATUS(status) == RERR_WECRASHED) { + rprintf(FLOG, + "rsync error: (3) Child proccess has CRASHED.\n"); + } + } #endif #ifndef HAVE_SIGACTION signal(SIGCHLD, sigchld_handler);