X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmakepath.c;h=422bcda82ac5c27113e04d6570b4d753b6bfa150;hb=2234a524956f7a24cd5d1396f0773d0583a5cca9;hp=d4eaadeec280e539f4b754e3aab0d9a8fb6ea926;hpb=e9179ab61463e64a338df16e7285ac50fc7d312b;p=gnulib.git diff --git a/lib/makepath.c b/lib/makepath.c index d4eaadeec..422bcda82 100644 --- a/lib/makepath.c +++ b/lib/makepath.c @@ -1,5 +1,7 @@ /* makepath.c -- Ensure that a directory path exists. - Copyright (C) 1990, 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + + Copyright (C) 1990, 1997, 1998, 1999, 2000, 2002, 2003 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 @@ -21,19 +23,9 @@ # include #endif -#if __GNUC__ -# define alloca __builtin_alloca -#else -# if HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - # pragma alloca -# else -char *alloca (); -# endif -# endif -#endif +#include "makepath.h" + +#include #include #include @@ -54,26 +46,15 @@ char *alloca (); # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) #endif -#if STDC_HEADERS -# include -#endif +#include -#if HAVE_ERRNO_H -# include -#endif +#include #ifndef errno extern int errno; #endif -#if HAVE_STRING_H -# include -#else -# include -# ifndef strchr -# define strchr index -# endif -#endif +#include #ifndef S_ISUID # define S_ISUID 04000 @@ -100,9 +81,6 @@ extern int errno; #define WX_USR (S_IWUSR | S_IXUSR) -/* Include this before libintl.h so we get our definition of PARAMS. */ -#include "makepath.h" - #include "gettext.h" #define _(msgid) gettext (msgid) @@ -118,10 +96,16 @@ extern int errno; Restore working directory. */ \ if (do_chdir) \ { \ - int _fail = restore_cwd (&cwd, NULL, NULL); \ + if (restore_cwd (&cwd) != 0) \ + { \ + int _saved_errno = errno; \ + error (0, errno, \ + _("failed to return to initial working directory")); \ + free_cwd (&cwd); \ + errno = _saved_errno; \ + return 1; \ + } \ free_cwd (&cwd); \ - if (_fail) \ - return 1; \ } \ } \ while (0) @@ -399,7 +383,7 @@ make_path (const char *argpath, *(p->dirname_end) = '\0'; if (chmod (dirpath, parent_mode)) { - error (0, errno, "cannot change permissions of %s", + error (0, errno, _("cannot change permissions of %s"), quote (dirpath)); retval = 1; }