X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsavewd.c;h=728bc8a7c8c7b2b5c8a1000f4ca13d11c09b38bc;hb=97799ab308e774e51358fe216d41a0f822c0c9d6;hp=dfb33b7ea3264ea750842f20f3b8d204b873d066;hpb=441aa3044f43e5572f58c354f01e6bc070acd5c7;p=gnulib.git diff --git a/lib/savewd.c b/lib/savewd.c index dfb33b7ea..728bc8a7c 100644 --- a/lib/savewd.c +++ b/lib/savewd.c @@ -1,6 +1,6 @@ /* Save and restore the working directory, possibly using a child process. - Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2009-2013 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 @@ -19,6 +19,8 @@ #include +#define SAVEWD_INLINE _GL_EXTERN_INLINE + #include "savewd.h" #include @@ -31,7 +33,7 @@ #include #include -#include "dirname.h" +#include "dosname.h" #include "fcntl-safer.h" /* Save the working directory into *WD, if it hasn't been saved @@ -45,7 +47,7 @@ savewd_save (struct savewd *wd) case INITIAL_STATE: /* Save the working directory, or prepare to fall back if possible. */ { - int fd = open_safer (".", O_RDONLY); + int fd = open_safer (".", O_SEARCH); if (0 <= fd) { wd->state = FD_STATE; @@ -105,7 +107,7 @@ savewd_chdir (struct savewd *wd, char const *dir, int options, || (options & (HAVE_WORKING_O_NOFOLLOW ? SAVEWD_CHDIR_NOFOLLOW : 0))) { fd = open (dir, - (O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK + (O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK | (options & SAVEWD_CHDIR_NOFOLLOW ? O_NOFOLLOW : 0))); if (open_result) @@ -254,7 +256,7 @@ savewd_finish (struct savewd *wd) This is why savewd_chdir is broken out into another function; savewd_chdir's callers _can_ inspect the file system to decide whether to call savewd_chdir. */ -static inline bool +static bool savewd_delegating (struct savewd const *wd) { return wd->state == FORKING_STATE && 0 < wd->val.child;