[PATCH v2 0/4] getcwd without PATH_MAX

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

 



Paths longer than PATH_MAX can be created and used on at least on some
file systems.  Currently we use getcwd() generally with a PATH_MAX-
sized buffer.  This series adds two functions, strbuf_getcwd() and
xgetcwd(), then uses them to reduce the number of fixed-sized buffers
and to allow us to handle longer working directory paths.

Not all getcwd() calls are replaced, however.  I hope that at least
some of the remaining ones can be avoided altogether.  If that turns
out to be too optimistic then we can use the added function to convert
the rest.

Changes in v2:
  * strbuf_getcwd() instead of strbuf_add_cwd(), because the former is
    simpler and sufficient for now; based on a suggestion by Duy
  * added patch 2 as an example for strbuf_getcwd() usage, suggested
    by Duy
  * made sure strbuf_getcwd() leaves the strbuf intact, no matter
    what getcwd() does
  * converted an easy getcwd() call in setup.c

René Scharfe (4):
  strbuf: add strbuf_getcwd()
  use strbuf_getcwd() to get the current working directory without
    fixed-sized buffers
  wrapper: add xgetcwd()
  use xgetcwd() get the current directory or die

 Documentation/technical/api-strbuf.txt |  4 ++++
 builtin/init-db.c                      | 25 ++++++++++++-------------
 builtin/rev-parse.c                    |  6 +++---
 dir.c                                  | 12 ++++++++----
 git-compat-util.h                      |  1 +
 git.c                                  |  6 ++++--
 setup.c                                |  6 +++---
 strbuf.c                               | 21 +++++++++++++++++++++
 strbuf.h                               |  1 +
 trace.c                                |  7 ++++---
 wrapper.c                              |  8 ++++++++
 11 files changed, 69 insertions(+), 28 deletions(-)

-- 
2.0.2

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