From 27928b9a264dfc6c6e5e700f10a9c6a140889cc2 Mon Sep 17 00:00:00 2001 From: korbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Thu, 4 Nov 1999 14:50:44 +0000 Subject: [PATCH] Allow for systems that do not have S_IR* defined values Do not call realloc with a NULL pointer git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30391 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/fixinc/fixincl.c | 20 +++++++++++++++++--- gcc/fixinc/fixlib.c | 5 ++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 527caf987aa9..73dae90219b2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -2,6 +2,16 @@ Thu Nov 4 06:39:47 1999 Jeffrey A Law (law@cygnus.com) * haifa-sched.c (schedule_block): Fix thinko. +1999-11-03 James McKelvey <mckelvey@fafnir.com> + + * fixinc/fixincl.c(create_file): Allow for systems that do not have + S_IR* defined values + +1999-11-03 Philippe De Muyter <phdm@macqel.be> + + * fixlib.c (load_file_data): Do not call `realloc' with a NULL pointer; + call `malloc' instead. + Wed Nov 3 23:05:14 1999 Mark Mitchell <mark@codesourcery.com> * flags.h (flag_renumber_insns): Declare. diff --git a/gcc/fixinc/fixincl.c b/gcc/fixinc/fixincl.c index 6a143fd95354..5a13cbeb212a 100644 --- a/gcc/fixinc/fixincl.c +++ b/gcc/fixinc/fixincl.c @@ -636,7 +636,22 @@ run_compiles () Input: the name of the file to create Returns: a file pointer to the new, open file */ -#define S_IRALL (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) +#if defined(S_IRUSR) && defined(S_IWUSR) && \ + defined(S_IRGRP) && defined(S_IROTH) + +# define S_IRALL (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) +#else +# define S_IRALL 0644 +#endif + +#if defined(S_IRWXU) && defined(S_IRGRP) && defined(S_IXGRP) && \ + defined(S_IROTH) && defined(S_IXOTH) + +# define S_DIRALL (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) +#else +# define S_DIRALL 0755 +#endif + FILE * create_file () @@ -660,8 +675,7 @@ create_file () *pz_dir = NUL; if (stat (fname, &stbf) < 0) { - mkdir (fname, S_IFDIR | S_IRWXU | S_IRGRP | S_IXGRP - | S_IROTH | S_IXOTH); + mkdir (fname, S_IFDIR | S_DIRALL); } *pz_dir = '/'; diff --git a/gcc/fixinc/fixlib.c b/gcc/fixinc/fixlib.c index 25a672ede4f0..85f92421222b 100644 --- a/gcc/fixinc/fixlib.c +++ b/gcc/fixinc/fixlib.c @@ -23,7 +23,10 @@ load_file_data (fp) if (space_left < 1024) { space_left += 4096; - pz_data = realloc ((void*)pz_data, space_left + space_used + 1 ); + if (pz_data) + pz_data = realloc ((void*)pz_data, space_left + space_used + 1 ); + else + pz_data = malloc (space_left + space_used + 1 ); } size_read = fread (pz_data + space_used, 1, space_left, fp); -- GitLab