[Libguestfs] [PATCH 1/3] New API: case-sensitive-path to return case sensitive path on NTFS 3g fs

Matthew Booth mbooth at redhat.com
Mon Oct 26 11:04:49 UTC 2009


On 26/10/09 10:52, Richard W.M. Jones wrote:
> On Mon, Oct 26, 2009 at 11:41:22AM +0100, Jim Meyering wrote:
>> Richard W.M. Jones wrote:
>>> +char *
>>> +do_case_sensitive_path (const char *path)
>>> +{
>>> +  char ret[PATH_MAX+1] = "/";
>>> +  size_t next = 1;
>>> +
>>> +  /* MUST chdir ("/") before leaving this function. */
>>> +  if (chdir (sysroot) == -1) {
>>
>> If this function might ever be used from a multi-threaded
>> application, then you'll want to change it not to use chdir,
>> since chdir changes the process-wide current directory.
>> That can cause rare but particularly hard to debug problems.
>
> This code would be much harder to write if we don't use chdir.  Any
> suggestions on that?  If there was a "readdirat" variant then that
> might be promising.

There's an fdopendir(), which returns the DIR* required by readdir().

Matt
-- 
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

M:       +44 (0)7977 267231
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490




More information about the Libguestfs mailing list