CVS update: php31/ext/mysql
| From: | rasmus | Date: | Sat, 22 Aug 1998 15:08:02 +0000 |
| Subject: | CVS update: php31/ext/mysql | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-478@lists.php.net to get a copy of this message | ||
Date: Saturday August 22, 1998 @ 11:08
Author: rasmus
Update of /repository/php31/ext/mysql
In directory asf:/export/home/rasmus/php31/ext/mysql
Modified Files:
mysql.c
Log Message:
Put signal handling back to be safe, but do it for both CGI and Apache
Index: php31/ext/mysql/mysql.c
diff -c php31/ext/mysql/mysql.c:2.3 php31/ext/mysql/mysql.c:2.4
*** php31/ext/mysql/mysql.c:2.3 Sat Aug 22 09:45:43 1998
--- php31/ext/mysql/mysql.c Sat Aug 22 11:08:01 1998
***************
*** 27,33 ****
+----------------------------------------------------------------------+
*/
! /* $Id: mysql.c,v 2.3 1998/08/22 13:45:43 rasmus Exp $ */
/* TODO:
--- 27,33 ----
+----------------------------------------------------------------------+
*/
! /* $Id: mysql.c,v 2.4 1998/08/22 15:08:01 rasmus Exp $ */
/* TODO:
***************
*** 59,65 ****
#include "internal_functions.h"
#include "ext/standard/php3_string.h"
#include "php3_mysql.h"
!
#if HAVE_MYSQL
#include <mysql.h>
#ifdef HAVE_MYSQL_REAL_CONNECT
--- 59,67 ----
#include "internal_functions.h"
#include "ext/standard/php3_string.h"
#include "php3_mysql.h"
! #if HAVE_SIGNAL_H
! #include <signal.h>
! #endif
#if HAVE_MYSQL
#include <mysql.h>
#ifdef HAVE_MYSQL_REAL_CONNECT
***************
*** 149,158 ****
#endif
#endif
- #if APACHE
- extern void timeout(int sig);
- #endif
-
#if defined(THREAD_SAFE)
typedef struct mysql_global_struct{
mysql_module php3_mysql_module;
--- 151,156 ----
***************
*** 174,198 ****
static void _close_mysql_link(MYSQL *link)
{
- #if APACHE
void (*handler) (int);
- #endif
MySQL_TLS_VARS;
mysql_close(link);
!
efree(link);
MySQL_GLOBAL(php3_mysql_module).num_links--;
}
static void _close_mysql_plink(MYSQL *link)
{
- #if APACHE
void (*handler) (int);
- #endif
MySQL_TLS_VARS;
mysql_close(link);
free(link);
MySQL_GLOBAL(php3_mysql_module).num_persistent--;
--- 172,195 ----
static void _close_mysql_link(MYSQL *link)
{
void (*handler) (int);
MySQL_TLS_VARS;
+ handler = signal(SIGPIPE, SIG_IGN); /* Just to be safe */
mysql_close(link);
! signal(SIGPIPE,handler);
efree(link);
MySQL_GLOBAL(php3_mysql_module).num_links--;
}
static void _close_mysql_plink(MYSQL *link)
{
void (*handler) (int);
MySQL_TLS_VARS;
+ handler = signal(SIGPIPE, SIG_IGN); /* Just to be safe */
mysql_close(link);
+ signal(SIGPIPE,handler);
free(link);
MySQL_GLOBAL(php3_mysql_module).num_persistent--;
***************
*** 328,336 ****
static void php3_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
{
- #if APACHE
void (*handler) (int);
- #endif
char *user,*passwd,*host,*tmp;
char *hashed_details;
int hashed_details_length;
--- 325,331 ----
***************
*** 455,466 ****
--- 450,463 ----
RETURN_FALSE;
}
/* ensure that the link did not die */
+ handler = signal(SIGPIPE,SIG_IGN);
#if defined(mysql_errno) && defined(CR_SERVER_GONE_ERROR)
mysql_stat(le->ptr);
if (mysql_errno((MYSQL *)le->ptr) == CR_SERVER_GONE_ERROR) {
#else
if (!strcasecmp(mysql_stat(le->ptr),"mysql server has gone away")) { /* the link
died */
#endif
+ signal(SIGPIPE,handler);
if (mysql_connect(le->ptr,host,user,passwd)==NULL) {
php3_error(E_WARNING,"MySQL: Link to server lost, unable to reconnect");
_php3_hash_del(plist, hashed_details, hashed_details_length+1);
***************
*** 468,473 ****
--- 465,471 ----
RETURN_FALSE;
}
}
+ signal(SIGPIPE,handler);
mysql = (MYSQL *) le->ptr;
}
return_value->value.lval = php3_list_insert(mysql,MySQL_GLOBAL(php3_mysql_module).le_plink);
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net