Re: [PATCH] C version of git-count-objects

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

 



On Thu, 27 Apr 2006, Junio C Hamano wrote:

> Nicolas Pitre <nico@xxxxxxx> writes:
> 
> > On Thu, 27 Apr 2006, Peter Hagervall wrote:
> >
> >> Answering the call Linus made[1], sort of, but for a completely
> >> different program.
> >> 
> >> Anyway, it ought to be at least as portable as the shell script, and a
> >> whole lot faster, however much that matters.
> >> 
> > [...]
> >> +	for (i = 0; i < 16; i++) {
> >> +		subdir[0] = hex_digits[i];
> >> +		for (j = 0; j < 16; j++) {
> >> +			subdir[1] = hex_digits[j];
> >> +			if (access(subdir, R_OK | X_OK))
> >> +				continue;
> >> +			chdir(subdir);
> >> +			if (!(dp = opendir("."))) {
> >> +				error("can't open subdir %s", subdir);
> >> +				continue;
> >> +			}
> >
> > Looks like you're missing a chdir(".."); there.
> 
> Why would you even _need_ to chdir() anywhere, anyway?

To avoid appending the filename to the path before each lstat() I'd 
guess.


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