Subject: bug#27871: [PATCH] Treat unreachable current directory as error

From: Philipp Stephani <[email-masked]>
Date: Sat, 07 Oct 2017 08:49:01 +0000

Paul Eggert <[email-masked]> schrieb am So., 1. Okt. 2017 um 02:00 Uhr:

> Philipp Stephani wrote:
>
> > +  if (!file_name_absolute_p (dir))
>
> That doesn't look right here, since leading '~' counts as absolute to
> file_name_absolute_p, which is not what is wanted here.
>

That shouldn't matter because getcwd never returns a string starting with ~.

>
> > +      errno = ENOTCONN;
>
> Why ENOTCONN? Shouldn't it be ENOENT? The failure has nothing to do with
> socket
> connections.
>

I think ENOTCONN is the error returned by stat(".") if the current
directory doesn't exist. But I don't care much about the exact error
number, any nonzero value should do the job.

>
> Also, I'd feel a bit better if we apply the workaround only to the
> function that
> has the problem.
>
>
All of the current directory functions exhibit this behavior, including
getwd and getcwd, so you need to make sure they are also covered.