Re: [PATCH v2 2/4] use strbuf_getcwd() to get the current working directory without fixed-sized buffers

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

 



On Mon, Jul 21, 2014 at 07:10:13PM +0200, René Scharfe wrote:

> Probably.  And I was so glad to have found an example case for getcwd
> without dying and without touching the get-there-and-back cases. :) Guess
> I'll have to look closer at setup.c and perhaps unix-socket.c for a
> replacement.

I think just:

  const char *x = xgetcwd();
  setenv(GIT_DIR_ENVIRONMENT, x, 0);
  free(x);

would be enough?

> By the way: Simply setting $GIT_DIR to "." probably won't work in the two
> cases, I guess?

It might, but I'd be a little wary. For example, for the call in
init_db, would we later then chdir to the working tree in order to do a
checkout (since init_db is part of a clone)? Even if it works now, it
seems like a bit of an accident waiting to happen.

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