Am 18.07.2014 15:08, schrieb Nguyễn Thái Ngọc Duy:
> diff --git a/lockfile.c b/lockfile.c
> index 8fbcb6a..a70d107 100644
> --- a/lockfile.c
> +++ b/lockfile.c
> @@ -280,3 +280,19 @@ void rollback_lock_file(struct lock_file *lk)
>       }
>       lk->filename[0] = 0;
>  }
> +
> +void make_locked_paths_absolute(void)
> +{
> +     struct lock_file *lk;
> +     const char *abspath;
> +     for (lk = lock_file_list; lk != NULL; lk = lk->next) {
> +             if (!lk->filename[0] || lk->filename[0] == '/')

Please use is_absolute_path().

> +                     continue;
> +             abspath = absolute_path(lk->filename);
> +             if (strlen(abspath) >= sizeof(lk->filename))
> +                     warning("locked path %s is relative when current 
> directory "
> +                             "is changed", lk->filename);
> +             else
> +                     strcpy(lk->filename, abspath);
> +     }
> +}

> --- a/run-command.c
> +++ b/run-command.c
> @@ -399,7 +399,7 @@ fail_pipe:
>                       close(cmd->out);
>               }
>  
> -             if (cmd->dir && chdir(cmd->dir))
> +             if (cmd->dir && chdir_safe(cmd->dir))

This one shouldn't be necessary: It's in the child, and the child
process does not release the locks; see the check for the owner in
remove_lock_file.

>                       die_errno("exec '%s': cd to '%s' failed", cmd->argv[0],
>                           cmd->dir);
>               if (cmd->env) {

-- Hannes

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to