[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fdopendir on non-directory
From: |
Samuel Thibault |
Subject: |
Re: fdopendir on non-directory |
Date: |
Sun, 18 Oct 2009 01:31:18 +0200 |
User-agent: |
Mutt/1.5.12-2006-07-14 |
Hello,
Roland McGrath, le Tue 06 Oct 2009 20:06:27 -0700, a écrit :
> fdopendir uses __file_name_lookup_under (port, "/", O_DIRECTORY | O_NOTRANS,
> 0)
> which I think is exactly right.
Mmm, I'd say "almost". That line means starting from directory one
should look at directory /, and what __hurd_file_name_lookup does is
startport = (file_name[0] == '/') ? INIT_PORT_CRDIR : INIT_PORT_CWDIR;
so that __file_name_lookup_under's use_init_port function receives
INIT_PORT_CRDIR as `which' parameter, not INIT_PORT_CWDIR, and thus
doesn't use `startdir' and just resolves "/", which indeed is a
directory :). This can be seen in rpctrace:
119->dir_lookup ("test" 1 0) = 0 1 "" 136
136->term_getctty () = 0xfffffed1 ((ipc/mig) bad request message ID)
120->dir_lookup ("/" 2097280 0) = 0 1 "" 138
(119 is CRDIR and 120 is CWDIR).
Shouldn't __file_name_lookup_under (port, ".", O_DIRECTORY | O_NOTRANS,
0) be more exactly right? At least it seems to be working:
118->dir_lookup ("test" 1 0) = 0 1 "" 135
135->term_getctty () = 0xfffffed1 ((ipc/mig) bad request message ID)
135->dir_lookup ("./" 2097280 0) = 0x40000014 (Not a directory)
Samuel