Re: Re* [PATCH 1/2] clone: allow to clone from .git file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 23, 2011 at 4:01 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> -const char *read_gitfile_gently(const char *path)
> +const char *read_gitfile_gently(const char *path, int *status)
>  {
>        char *buf;
>        char *dir;
> @@ -389,20 +391,39 @@ const char *read_gitfile_gently(const char *path)
>        if (!S_ISREG(st.st_mode))
>                return NULL;

Set *status here too? I assume we need valid *status whenever NULL is returned.

>        fd = open(path, O_RDONLY);
> -       if (fd < 0)
> -               die_errno("Error opening '%s'", path);
> +       if (fd < 0) {
> +               if (!status)
> +                       die_errno("Error opening '%s'", path);
> +               *status = ERROR_READ_GITFILE_CANTOPEN;
> +               return NULL;
> +       }
>        buf = xmalloc(st.st_size + 1);
>        len = read_in_full(fd, buf, st.st_size);
>        close(fd);
-- 
Duy
--
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]