From: Duy Nguyen Date: Sat, 19 Jul 2014 12:51:05 GMT Subject: Re: [PATCH] abspath.c: use PATH_MAX in real_path_internal() Message-ID: In-Reply-To: <53C9387D.4090504@web.de> On Fri, Jul 18, 2014 at 10:08 PM, René Scharfe wrote: >> We could wrap this "get cwd, cd back" pattern as well. So "save_cwd" >> returns an opaque pointer, "go_back" takes the pointer, (f)chdir back >> and free the pointer if needed. On platforms that support fchdir, it >> can be used, else we fall back to chdir. I think there are only four >> places that follow this pattern, here, setup.c (.git discovery), git.c >> (restore_env) and unix-socket.c. Enough call sites to make it worth >> the effort? > > On a cursory look I didn't find any more potential users. Something > like this? I think it looks nice. > Applying it to setup.c looks difficult to impossible, though. Yeah, setup.c needs cwd as a string because it does something else to cwd besides going back. Too bad. -- Duy