[Top][All Lists]

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

glibc: changing file_name_split()'s interface slightly to fix the "/" ca

From: Jérémie Koenig
Subject: glibc: changing file_name_split()'s interface slightly to fix the "/" case
Date: Sat, 12 Jun 2010 22:48:50 +0200


The file_name_split(const char *path, char **name) function from glibc
resolves the parent directory for 'path' into a port (which is
returned) and makes '*name' point into 'path' at the beginning of the
base name. See 

There is a bug when 'path' is "/":
  * file_name_split() returns (<root port>, "")
  * the directory_name_split() variant returns (<CWD port>, "/")

The subsequent dir_* RPC calls generally fails with EINVAL. Compare
for instance the result of "mkdir /" vs. "mkdir /."

If there's no objection I would like to submit the attached patch for
inclusion in glibc. It returns the root port and a constant "." string
when the path is "/". Though this would change the interface slightly,
I have checked the code in glibc and the only use case for the
returned name is passing it to an RPC call and never using it again.
The only usage in hurd (namely, in nfsd) is similar.

In your opinion is this acceptable?

PS: I'll put a modified glibc package in my repository tomorrow (the
build takes like 12 hours). However I've tested the patch with the
remains of a failed build and it seems it works as exepected. BTW, a
modified gnumach with ramdisk is there as well (deb
http://jk.fr.eu.org/debian unstable/).
Jérémie Koenig <jk@jk.fr.eu.org>

Attachment: file_name_split.diff
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]