From: Nguyen Thai Ngoc Duy Date: Tue, 23 Aug 2011 01:11:29 GMT Subject: Re: Re* [PATCH 1/2] clone: allow to clone from .git file Message-ID: In-Reply-To: <7vty99upn9.fsf_-_@alter.siamese.dyndns.org> On Tue, Aug 23, 2011 at 4:01 AM, Junio C Hamano 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