X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmakepath.c;h=d4eaadeec280e539f4b754e3aab0d9a8fb6ea926;hb=ef8e4e5cfec5367d1c3c3aedf15408371de20f6d;hp=fbe3f6a65e1f25ac24197e471306afe9bc70d855;hpb=f9fa25dca3c78a2298e466e1b33caca0ee7e458b;p=gnulib.git diff --git a/lib/makepath.c b/lib/makepath.c index fbe3f6a65..d4eaadeec 100644 --- a/lib/makepath.c +++ b/lib/makepath.c @@ -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 @@ -303,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 ) @@ -347,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. */ @@ -356,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)); @@ -384,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; }