X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmakepath.c;h=422bcda82ac5c27113e04d6570b4d753b6bfa150;hb=55da53d0db0c7a9fd82b2abc809560b3089df6a5;hp=42a0cf5402309193475380a7eb5d279bcb632068;hpb=68af56be3e061b97cf97150094bc50b0aa364cbb;p=gnulib.git diff --git a/lib/makepath.c b/lib/makepath.c index 42a0cf540..422bcda82 100644 --- a/lib/makepath.c +++ b/lib/makepath.c @@ -23,6 +23,8 @@ # include #endif +#include "makepath.h" + #include #include @@ -44,9 +46,7 @@ # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) #endif -#if STDC_HEADERS -# include -#endif +#include #include @@ -54,14 +54,7 @@ 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 @@ -88,8 +81,6 @@ extern int errno; #define WX_USR (S_IWUSR | S_IXUSR) -#include "makepath.h" - #include "gettext.h" #define _(msgid) gettext (msgid) @@ -105,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) @@ -386,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; }