Michael Haggerty <mhagger@xxxxxxxxxxxx> writes: > @@ -54,20 +73,36 @@ const char *real_path(const char *path) > } > > if (*buf) { > - if (!*cwd && !getcwd(cwd, sizeof(cwd))) > - die_errno ("Could not get current working directory"); > + if (!*cwd && !getcwd(cwd, sizeof(cwd))) { > + if (die_on_error) > + die_errno("Could not get current working directory"); > + else > + goto error_out; > + } > > - if (chdir(buf)) > - die_errno ("Could not switch to '%s'", buf); > + if (chdir(buf)) { > + if (die_on_error) > + die_errno("Could not switch to '%s'", buf); > + else > + goto error_out; > + } > + } The patch makes sense, but while you are touching this code, I have to wonder if there is an easy way to tell, before entering the loop, if we have to chdir() around in the loop. That would allow us to hoist the getcwd() that is done only so that we can come back to where we started outside the loop, making it clear why the call is there, instead of cryptic "if (!*cwd &&" to ensure we do getcwd() once and before doing any chdir(). -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html