Module Name: src Committed By: christos Date: Tue Aug 21 15:37:34 UTC 2018
Modified Files: src/external/gpl2/xcvs/dist/src: main.c run.c Log Message: support SIGINFO To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/gpl2/xcvs/dist/src/main.c cvs rdiff -u -r1.3 -r1.4 src/external/gpl2/xcvs/dist/src/run.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/gpl2/xcvs/dist/src/main.c diff -u src/external/gpl2/xcvs/dist/src/main.c:1.6 src/external/gpl2/xcvs/dist/src/main.c:1.7 --- src/external/gpl2/xcvs/dist/src/main.c:1.6 Tue May 17 10:00:09 2016 +++ src/external/gpl2/xcvs/dist/src/main.c Tue Aug 21 11:37:33 2018 @@ -17,7 +17,7 @@ * */ #include <sys/cdefs.h> -__RCSID("$NetBSD: main.c,v 1.6 2016/05/17 14:00:09 christos Exp $"); +__RCSID("$NetBSD: main.c,v 1.7 2018/08/21 15:37:33 christos Exp $"); #include "cvs.h" @@ -498,6 +498,32 @@ divide_by (unsigned char buf[COMMITID_RA return carry; } +#ifdef SIGINFO +#include <paths.h> + +static void +show_status (int n) +{ + char wd[PATH_MAX]; + char buf[2048]; + static int ttyfd = -2; + + if (ttyfd == -2) + ttyfd = open(_PATH_TTY, O_RDWR, O_CLOEXEC); + + if (ttyfd == -1) + return; + + if (getcwd(wd, sizeof(wd)) == NULL) + return; + n = snprintf(buf, sizeof(buf), "%s[%d]: working in %s\n", getprogname(), + (int)getpid(), wd); + if (n <= 0) + return; + write(ttyfd, buf, (size_t)n); +} +#endif + static void convert (char const input[COMMITID_RAW_SIZE], char *output) { @@ -967,6 +993,9 @@ cause intermittent sandbox corruption.") /* make sure we clean up on error */ signals_register (main_cleanup); +#ifdef SIGINFO + signal (SIGINFO, show_status); +#endif #ifdef KLUDGE_FOR_WNT_TESTSUITE /* Probably the need for this will go away at some point once Index: src/external/gpl2/xcvs/dist/src/run.c diff -u src/external/gpl2/xcvs/dist/src/run.c:1.3 src/external/gpl2/xcvs/dist/src/run.c:1.4 --- src/external/gpl2/xcvs/dist/src/run.c:1.3 Tue May 17 10:00:09 2016 +++ src/external/gpl2/xcvs/dist/src/run.c Tue Aug 21 11:37:33 2018 @@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: run.c,v 1.3 2016/05/17 14:00:09 christos Exp $"); +__RCSID("$NetBSD: run.c,v 1.4 2018/08/21 15:37:33 christos Exp $"); #include "cvs.h" @@ -239,6 +239,9 @@ run_exec (const char *stin, const char * #endif if (pid == 0) { +#ifdef SIGINFO + signal (SIGINFO, SIG_DFL); +#endif #ifdef SETXID_SUPPORT if (flags & RUN_UNSETXID) { (void) setgid (getgid ()); @@ -570,6 +573,9 @@ piped_child (char *const *command, int * error (1, errno, "cannot fork"); if (pid == 0) { +#ifdef SIGINFO + signal (SIGINFO, SIG_DFL); +#endif if (dup2 (to_child_pipe[0], STDIN_FILENO) < 0) error (1, errno, "cannot dup2 pipe"); if (close (to_child_pipe[1]) < 0)