Commits

Anonymous committed c05ef79

r2515@LENOVO-6D4C2336: sugawara | 2008-09-14 11:28:46 +0900

  • Participants
  • Parent commits 6287efd

Comments (0)

Files changed (1)

ext/libtar/lib/wrapper.c

 # include <string.h>
 #endif
 
-#ifdef HAVE_SIGACTION
-#include <signal.h>
-#endif
-
-#if defined(_WIN32) || defined(HAVE_SIGACTION)
-static int __tarruby_interrupted__ = 0;
-#endif
-
-#ifdef _WIN32
-static BOOL WINAPI interrupted_handler(DWORD CtrlType) {
-	if (CTRL_C_EVENT == CtrlType) {
-		__tarruby_interrupted__ = 1;
-		return FALSE;
-	} else {
-		return TRUE;
-	}
-}
-
-void tarruby_interrupted() {
-	SetConsoleCtrlHandler(interrupted_handler, TRUE);
-}
-#endif
-
-#ifdef HAVE_SIGACTION
-static void interrupted_handler(int no) {
-	__tarruby_interrupted__ = 1;
-}
-
-void tarruby_interrupted() {
-	char buff[256];
-	int ret;
-	struct sigaction sa;
-
-	memset(&sa, 0, sizeof(struct sigaction));
-	sa.sa_handler = interrupted_handler;
-	sa.sa_flags |= SA_RESTART;
-	sigaction(SIGINT, &sa, NULL);
-}
-#endif
-
 int
 tar_extract_glob(TAR *t, char *globname, char *prefix)
 {
 	char buf[MAXPATHLEN];
 	int i;
 
-#if defined(_WIN32) || defined(HAVE_SIGACTION)
-	__tarruby_interrupted__ = 0;
-#endif
-
 	while ((i = th_read(t)) == 0)
 	{
-#if defined(_WIN32) || defined(HAVE_SIGACTION)
-		if (__tarruby_interrupted__) {
-			errno = EINTR;
-			__tarruby_interrupted__ = 0;
-			return -1;
-		}
-#endif
 		filename = th_get_pathname(t);
 		if (fnmatch(globname, filename, FNM_PATHNAME | FNM_PERIOD))
 		{
 	char buf[MAXPATHLEN];
 	int i;
 
-#if defined(_WIN32) || defined(HAVE_SIGACTION)
-	__tarruby_interrupted__ = 0;
-#endif
-
 #ifdef DEBUG
 	printf("==> tar_extract_all(TAR *t, \"%s\")\n",
 	       (prefix ? prefix : "(null)"));
 #ifdef DEBUG
 		puts("    tar_extract_all(): calling th_get_pathname()");
 #endif
-#if defined(_WIN32) || defined(HAVE_SIGACTION)
-		if (__tarruby_interrupted__) {
-			errno = EINTR;
-			__tarruby_interrupted__ = 0;
-			return -1;
-		}
-#endif
 		filename = th_get_pathname(t);
 		if (t->options & TAR_VERBOSE)
 			th_print_long_ls(t);
 #if defined(_WIN32)
 	int errorp = 0;
 #endif
-#if defined(_WIN32) || defined(HAVE_SIGACTION)
-	__tarruby_interrupted__ = 0;
-#endif
 
 #ifdef DEBUG
 	printf("==> tar_append_tree(0x%lx, \"%s\", \"%s\")\n",
 	}
 	while ((dent = readdir(dp)) != NULL)
 	{
-#if defined(_WIN32) || defined(HAVE_SIGACTION)
-		if (__tarruby_interrupted__) {
-			errno = EINTR;
-			__tarruby_interrupted__ = 0;
-			return -1;
-		}
-#endif
 		if (strcmp(dent->d_name, ".") == 0 ||
 		    strcmp(dent->d_name, "..") == 0)
 			continue;