Re: [RFC PATCH 1/6] msvc: opendir: use xmalloc

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

 



Erik Faye-Lund wrote:

> --- a/compat/msvc.c
> +++ b/compat/msvc.c
> @@ -7,16 +7,13 @@ DIR *opendir(const char *name)
>  {
>  	int len;
>  	DIR *p;
> -	p = (DIR*)malloc(sizeof(DIR));
> +	p = xmalloc(sizeof(DIR));
>  	memset(p, 0, sizeof(DIR));
>  	strncpy(p->dd_name, name, PATH_MAX);
>  	len = strlen(p->dd_name);
>  	p->dd_name[len] = '/';
>  	p->dd_name[len+1] = '*';
>  
> -	if (p == NULL)
> -		return NULL;

A behavior change but maybe a good one.  For example, the
prune_packed_objects() loop currently skips object dirs it can't open,
even if that is due to memory exhaustion, but this changes it to error
out.

What is the motivation?
--
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]