I believe the "~" shorthand is something that the shells expand, not
something the kernel inherently knows about. Indeed, I doubt the kernel
knows anything about something that high-level at all. But there may be
 some standard function to do this translation.

Cheers,
Adrian

On Fri, Nov 12, 2010 at 2:37 PM, h.g. muller <h.g.mul...@hccnet.nl> wrote:

> I don't think this is the correct patch.
>
> The true problem is the *strchr(buf, '/') = 0; statement in the else part.
> This assumes that in any pathname starting with ~ there will be a slash,
> and causes the segfault if there is none. The patch merely diverts control
> to the else part in case there happens to be a space after the ~,
> but there are plenty cases with neither space nor slash, and they would
> keep segfaulting.
>
> I am a bit surprised to find this code anyway: I am not a Linux man, and
> I thought that ~ was a standard filename convention handled by the kernel,
> like it handles / as root. I was not aware that every application has to
> make
> the translation to home directory by itself. Yet this is what the code
> seems
> to be for.
>
> If this code indeed has to be kept, the proper solution would be to skip
> the assignment if there is no /, i.e.
>
> { char *p; if(p = strchr(buf, '/')) *p = 0; }
> _______________________________________________
> Bug-XBoard mailing list
> Bug-XBoard@gnu.org
> http://lists.gnu.org/mailman/listinfo/bug-xboard
>
_______________________________________________
Bug-XBoard mailing list
Bug-XBoard@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-xboard

Reply via email to