Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37780917
en ru br
Репозитории ALT
S:2.22-alt9
5.1: 2.22-alt2
4.1: 2.22-alt2
4.0: 2.22-alt2
3.0: 2.22-alt1
www.altlinux.org/Changes

Группа :: Разработка/Perl
Пакет: perl-CGI-SpeedyCGI

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: perl-CGI-SpeedyCGI-2.22-strerror.patch
Скачать


Patch by Niko Tyni <ntyni@iki.fi> for perl-CGI-SpeedyCGI >= 2.22, which tries to avoid the
crashing while printing a fatal error.
--- CGI-SpeedyCGI-2.22/src/speedy_util.c		2003-10-07 06:03:48.000000000 +0200
+++ CGI-SpeedyCGI-2.22/src/speedy_util.c.strerror	2008-05-04 20:25:53.000000000 +0200
@@ -96,13 +96,42 @@
 }
 
 static void just_die(const char *fmt, va_list ap) {
+   /*
+    * All this strerror_r() stuff is here because
+    * including perl.h in some cases (Perl 5.8?) replaces
+    * strerr() with a wrapper that needs an embedded perl
+    * interpreter running. Otherwise we get SIGSEGV when
+    * accessing interpreter-specific global variables for the
+    * strerror buffer
+    *
+    * Furthermore, there are two implementations of
+    * strerror_r() out there, with different prototypes.
+    */
+
     char buf[2048];
+#ifdef HAS_STRERROR_R
+    char errbuf[256];
+    int errsv;
+#endif
 
     sprintf(buf, "%s[%u]: ", SPEEDY_PROGNAME, (int)getpid());
     vsprintf(buf + strlen(buf), fmt, ap);
     if (errno) {
 	strcat(buf, ": ");
+#ifdef HAS_STRERROR_R
+#ifdef _GNU_SOURCE
+	strcat(buf, strerror_r(errno, errbuf, sizeof(errbuf)));
+#else /* ! _GNU_SOURCE */
+	errsv = errno;
+	if (strerror_r(errsv, errbuf, sizeof(errbuf))
+	    sprintf(buf + strlen(buf), "(errno = %d)", errsv);
+	else
+	    strcat(buf, errbuf);
+	}
+#endif
+#else /* ! HAS_STRERROR_R */
 	strcat(buf, strerror(errno));
+#endif /* HAS_STRERROR_R */
     }
     strcat(buf, "\n");
 #   ifdef SPEEDY_DEBUG
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin