summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/setup.c b/setup.c
index 0309c27821..000ffa810e 100644
--- a/setup.c
+++ b/setup.c
@@ -134,19 +134,20 @@ int path_inside_repo(const char *prefix, const char *path)
int check_filename(const char *prefix, const char *arg)
{
- const char *name;
char *to_free = NULL;
struct stat st;
if (starts_with(arg, ":/")) {
if (arg[2] == '\0') /* ":/" is root dir, always exists */
return 1;
- name = arg + 2;
- } else if (prefix)
- name = to_free = prefix_filename(prefix, arg);
- else
- name = arg;
- if (!lstat(name, &st)) {
+ arg += 2;
+ prefix = NULL;
+ }
+
+ if (prefix)
+ arg = to_free = prefix_filename(prefix, arg);
+
+ if (!lstat(arg, &st)) {
free(to_free);
return 1; /* file exists */
}