X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmakepath.c;h=bb6a09c12ca8f895a6cac13a039c85213a3c1fb2;hb=6b9607c0590a93ecbd2827492adf3fd3834e8f03;hp=3ca5c97654ac29e5073bf359afbff2abef36c223;hpb=b06578954912a7dcfbe0c6f6efca230b04ad0e7f;p=gnulib.git diff --git a/lib/makepath.c b/lib/makepath.c index 3ca5c9765..bb6a09c12 100644 --- a/lib/makepath.c +++ b/lib/makepath.c @@ -18,6 +18,17 @@ /* Written by David MacKenzie and Jim Meyering . */ +#ifdef HAVE_CONFIG_H +#if defined (CONFIG_BROKETS) +/* We use instead of "config.h" so that a compilation + using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h + (which it would do because it found this file in $srcdir). */ +#include +#else +#include "config.h" +#endif +#endif + #ifdef __GNUC__ #define alloca __builtin_alloca #else @@ -38,14 +49,26 @@ char *alloca (); #ifdef HAVE_UNISTD_H #include #endif + +#ifdef STAT_MACROS_BROKEN +#ifdef S_ISDIR +#undef S_ISDIR +#endif +#endif /* STAT_MACROS_BROKEN. */ + #if !defined(S_ISDIR) && defined(S_IFDIR) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif #ifdef STDC_HEADERS -#include #include -#else +#endif + +#ifdef HAVE_ERRNO_H +#include +#endif + +#ifndef STDC_HEADERS extern int errno; #endif @@ -95,7 +118,7 @@ make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string) int retval = 0; int oldmask = umask (0); - dirpath = alloca (strlen (argpath) + 1); + dirpath = (char *) alloca (strlen (argpath) + 1); strcpy (dirpath, argpath); if (stat (dirpath, &stats)) @@ -147,7 +170,7 @@ make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string) if (owner != (uid_t) -1 && group != (gid_t) -1 && chown (dirpath, owner, group) -#ifdef AFS +#if defined(AFS) && defined (EPERM) && errno != EPERM #endif )