Applied patch from Peter Rienstra for HP-UX 64

SVN revision: 1885
This commit is contained in:
Stefan Ritt 2007-07-13 10:23:23 +00:00
parent 118af2854e
commit ba028e1805

View File

@ -567,7 +567,7 @@ int my_read(int fh, void *buffer, unsigned int bytes)
int i, n = 0; int i, n = 0;
do { do {
i = read(fh, buffer + n, bytes - n); i = read(fh, (char *)buffer + n, bytes - n);
/* don't return if an alarm signal was cought */ /* don't return if an alarm signal was cought */
if (i == -1 && errno == EINTR) if (i == -1 && errno == EINTR)
@ -646,6 +646,10 @@ void *xmalloc(size_t bytes)
{ {
char *temp; char *temp;
/* Align buffer on 4 byte boundery for HP UX and other 64 bit systems to prevent Bus error (core dump) */
if (bytes & 3)
bytes += 4 - (bytes & 3);
temp = (char *) malloc(bytes + 12); temp = (char *) malloc(bytes + 12);
if (temp == 0) if (temp == 0)
memory_error_and_abort("xmalloc"); memory_error_and_abort("xmalloc");
@ -662,6 +666,10 @@ void *xcalloc(size_t count, size_t bytes)
{ {
char *temp; char *temp;
/* Align buffer on 4 byte boundery for HP UX and other 64 bit systems to prevent Bus error (core dump) */
if (bytes & 3)
bytes += 4 - (bytes & 3);
temp = (char *) malloc(count * bytes + 12); temp = (char *) malloc(count * bytes + 12);
if (temp == 0) if (temp == 0)
memory_error_and_abort("xcalloc"); memory_error_and_abort("xcalloc");
@ -680,6 +688,10 @@ void *xrealloc(void *pointer, size_t bytes)
char *temp; char *temp;
int old_size; int old_size;
/* Align buffer on 4 byte boundery for HP UX and other 64 bit systems to prevent Bus error (core dump) */
if (bytes & 3)
bytes += 4 - (bytes & 3);
if (pointer == NULL) if (pointer == NULL)
return xmalloc(bytes); return xmalloc(bytes);
@ -23344,7 +23356,7 @@ void show_top_selection_page()
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void show_selection_page() void show_selection_page(void)
{ {
int i, j, expand_all, show_title; int i, j, expand_all, show_title;
char str[10000], file_name[256]; char str[10000], file_name[256];
@ -23975,7 +23987,7 @@ void interprete(char *lbook, char *path)
/* if no logbook given, display logbook selection page */ /* if no logbook given, display logbook selection page */
if (!logbook[0] && !path[0]) { if (!logbook[0] && !path[0]) {
if (n > 1) { if (n > 1) {
show_selection_page(NULL); show_selection_page();
return; return;
} }
@ -24285,7 +24297,7 @@ void interprete(char *lbook, char *path)
/* from here on, logbook must be valid */ /* from here on, logbook must be valid */
if (!logbook[0]) { if (!logbook[0]) {
show_selection_page(NULL); show_selection_page();
return; return;
} }