Re: [PATCH] Add platform-independent .git "symlink"

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

 



Hi,

On Sat, 2 Feb 2008, Lars Hjemli wrote:

> On Feb 2, 2008 7:19 PM, Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote:
>
> > On Sat, 2 Feb 2008, Lars Hjemli wrote:
> >
> > > +     if (len < 10 || buf[len - 1] != '\n' || strncmp(buf, "GITDIR: ", 8))
> >
> > Sorry, missed that earlier: How about
> >
> >         if (!len || buf[len-1] != '\n' || prefixcmp(buf, "GITDIR: "))
> >
> > instead?  (buf does not need be NUL terminated for the prefixcmp(), since
> > we just made sure it is LF terminated)
> 
> That's true, although it feels a bit too clever for me ;-)

:-)

> Maybe this as a compromise?
> 
> 	static char buf[PATH_MAX + 9];  /* "GITDIR: " + "\n"  */
> ...
> 	if (!len || buf[len - 1] != '\n')
> 		return NULL;
> 	buf[len - 1] = '\0';
> 	if (prefixcmp(buf, "GITDIR: "))
> 		return NULL;

Sure!

Thanks,
Dscho

-
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]

  Powered by Linux