Re: [PATCH] system_path: use a static buffer

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

 



On Thu, Mar 17, 2011 at 9:24 PM, Carlos MartÃn Nieto <cmn@xxxxxxxx> wrote:
> - Â Â Â static const char *system_wide;
> - Â Â Â if (!system_wide)
> - Â Â Â Â Â Â Â system_wide = system_path(ETC_GITATTRIBUTES);
> + Â Â Â static char system_wide[PATH_MAX];

...

> - Â Â Â static const char *system_wide;
> - Â Â Â if (!system_wide)
> - Â Â Â Â Â Â Â system_wide = system_path(ETC_GITCONFIG);
> + Â Â Â static char system_wide[PATH_MAX];

...

> Â#ifdef RUNTIME_PREFIX
> - Â Â Â static const char *prefix;
> + Â Â Â static const char *prefix = NULL;
> Â#else
> Â Â Â Âstatic const char *prefix = PREFIX;
> Â#endif
> - Â Â Â struct strbuf d = STRBUF_INIT;
> + Â Â Â static char buf[PATH_MAX];
> + Â Â Â int ret;

It was pointed out elsewhere [1] that PATH_MAX only specifies max
length of a path element, not full path. I think we'd need to stay
away from preallocated PATH_MAX-sized arrays.

[1] http://mid.gmane.org/AANLkTikXvx7-Q8B_dqG5mMHGK_Rw-dFaeQdXi0zW98SD@xxxxxxxxxxxxxx
-- 
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]