Commit bee3f072 authored by heikki@hundin.mysql.fi's avatar heikki@hundin.mysql.fi
Browse files

ha_innobase.cc, ut0ut.c, univ.i, ut0ut.h:

  Redefine sprintf as ut_sprintf inside InnoDB code; some old Unixes may have a pointer as the return type of sprintf
lock0lock.c:
  Add safety against buffer overruns in latest deadlock info
srv0srv.c:
  Add safety against buffer overruns in SHOW INNODB STATUS
os0thread.h, os0thread.c:
  Fix a portability bug introduced in Windows when we changed os_thread_id_t to be the same as os_thread_t
parent 0005f28b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -70,7 +70,9 @@ os_thread_create(
	void*			arg,		/* in: argument to start
						function */
	os_thread_id_t*		thread_id);	/* out: id of created
						thread */	
						thread; currently this is
						identical to the handle to
						the thread */
/*********************************************************************
A thread calling this function ends its execution. */

+6 −0
Original line number Diff line number Diff line
@@ -63,6 +63,12 @@ Microsoft Visual C++ */
#define HAVE_PWRITE
#endif

/* Apparently in some old SCO Unixes the return type of sprintf is not
an integer as it should be according to the modern Posix standard. Because
of that we define sprintf inside InnoDB code as our own function ut_sprintf */
#undef  sprintf
#define sprintf    ut_sprintf

#endif

/*			DEBUG VERSION CONTROL
+12 −0
Original line number Diff line number Diff line
@@ -17,6 +17,18 @@ Created 1/20/1994 Heikki Tuuri

typedef time_t	ib_time_t;


/************************************************************
Uses vsprintf to emulate sprintf so that the function always returns
the printed length. Apparently in some old SCO Unixes sprintf did not
return the printed length but a pointer to the end of the printed string. */

ulint
ut_sprintf(
/*=======*/
        char*       buf,     /* in/out: buffer where to print */
        const char* format,  /* in: format of prints */
        ...);                /* in: arguments to be printed */
/************************************************************
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
but since there seem to be compiler bugs in both gcc and Visual C++,
+2 −0
Original line number Diff line number Diff line
@@ -2754,6 +2754,8 @@ lock_deadlock_occurs(
		err_buf += sprintf(err_buf,
		"*** WE ROLL BACK TRANSACTION (2)\n");

		ut_a(strlen(lock_latest_err_buf) < 4100);

		/*
		sess_raise_error_low(trx, DB_DEADLOCK, lock->type_mode, table,
						index, NULL, NULL, NULL);
+9 −2
Original line number Diff line number Diff line
@@ -96,17 +96,20 @@ os_thread_create(
	void*			arg,		/* in: argument to start
						function */
	os_thread_id_t*		thread_id)	/* out: id of created
						thread */	
						thread; currently this is
						identical to the handle to
						the thread */
{
#ifdef __WIN__
	os_thread_t	thread;
	ulint           win_thread_id;

	thread = CreateThread(NULL,	/* no security attributes */
				0,	/* default size stack */
				(LPTHREAD_START_ROUTINE)start_f,
				arg,
				0,	/* thread runs immediately */
				thread_id);
				&win_thread_id);

	if (srv_set_thread_priorities) {

@@ -117,6 +120,8 @@ os_thread_create(
	        ut_a(SetThreadPriority(thread, srv_query_thread_priority));
	}

	*thread_id = thread;

	return(thread);
#else
	int		ret;
@@ -134,6 +139,8 @@ os_thread_create(
	        my_pthread_setprio(pthread, srv_query_thread_priority);
	}

	*thread_id = pthread;

	return(pthread);
#endif
}
Loading