X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmakepath.c;h=d4eaadeec280e539f4b754e3aab0d9a8fb6ea926;hb=2bf674b2395b6aff54eff7928d24f2995c37c28e;hp=7fdc4e082ff7d340aaebc3e99daf7a4c1510ea22;hpb=7bf6449a9e1ef29eb8f6e271305fdc93bfe9d6fc;p=gnulib.git diff --git a/lib/makepath.c b/lib/makepath.c index 7fdc4e082..d4eaadeec 100644 --- a/lib/makepath.c +++ b/lib/makepath.c @@ -1,5 +1,5 @@ /* makepath.c -- Ensure that a directory path exists. - Copyright (C) 1990, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1990, 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ char *alloca (); # undef S_ISDIR #endif -#if !defined(S_ISDIR) && defined(S_IFDIR) +#if !defined S_ISDIR && defined S_IFDIR # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif @@ -103,16 +103,8 @@ extern int errno; /* Include this before libintl.h so we get our definition of PARAMS. */ #include "makepath.h" -#if HAVE_LOCALE_H -# include -#endif - -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define _(Text) Text -#endif +#include "gettext.h" +#define _(msgid) gettext (msgid) #include "save-cwd.h" #include "dirname.h" @@ -311,7 +303,7 @@ make_path (const char *argpath, if ((owner != (uid_t) -1 || group != (gid_t) -1) && chown (basename_dir, owner, group) -#if defined(AFS) && defined (EPERM) +#if defined AFS && defined EPERM && errno != EPERM #endif ) @@ -338,7 +330,7 @@ make_path (const char *argpath, stat and mkdir process O(n^2) file name components. */ if (do_chdir && chdir (basename_dir) < 0) { - error (0, errno, _("cannot chdir to directory, %s"), + error (0, errno, _("cannot chdir to directory %s"), quote (dirpath)); CLEANUP; return 1; @@ -355,6 +347,9 @@ make_path (const char *argpath, if (!do_chdir) basename_dir = dirpath; + /* Done creating leading directories. Restore original umask. */ + umask (oldmask); + /* We're done making leading directories. Create the final component of the path. */ @@ -364,9 +359,6 @@ make_path (const char *argpath, return 1; } - /* Done creating directories. Restore original umask. */ - umask (oldmask); - if (verbose_fmt_string != NULL) error (0, 0, verbose_fmt_string, quote (dirpath)); @@ -392,7 +384,8 @@ make_path (const char *argpath, if ((mode & ~S_IRWXUGO) && chmod (basename_dir, mode)) { - error (0, errno, _("cannot change permissions of %s"), quote (dirpath)); + error (0, errno, _("cannot change permissions of %s"), + quote (dirpath)); retval = 1; }