This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c
- From: Andrew Haley <aph at redhat dot com>
- To: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: gcc-patches at gcc dot gnu dot org, binutils at sourceware dot org, gdb at sourceware dot org
- Date: Sat, 26 Mar 2005 14:27:09 +0000
- Subject: Re: [PATCH/libiberty] Add missing <sys/types.h> in unlink-if-ordinary.c
- References: <200503261421.j2QEL6ll019253@elgar.sibelius.xs4all.nl>
Mark Kettenis writes:
> One really shouldn't include <sys/stat.h> without <sys/types.h> on
> BSD-derived systems. On most modern BSD's it is brought in by
> <unistd.h> but vax-dec-ultrix4.0 doesn't have one, so things break.
> The attached patch fixes that.
>
You must wrap this in #ifdef HAVE_SYS_TYPES_H
Andrew.
>
> Index: ChangeLog
> from Mark Kettenis <kettenis@gnu.org>
>
> * unlink-if-ordinary.c: Include <sys/types.h>.
>
> Index: unlink-if-ordinary.c
> ===================================================================
> RCS file: /cvs/src/src/libiberty/unlink-if-ordinary.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 unlink-if-ordinary.c
> --- unlink-if-ordinary.c 1 Mar 2005 14:33:00 -0000 1.1
> +++ unlink-if-ordinary.c 26 Mar 2005 14:18:20 -0000
> @@ -39,6 +39,8 @@ was made to unlink the file because it i
> #include "config.h"
> #endif
>
> +#include <sys/types.h>
> +
> #ifdef HAVE_UNISTD_H
> #include <unistd.h>
> #endif