bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] findprog-in: Set errno to indicate why NULL was returned.


From: Bruno Haible
Subject: Re: [PATCH] findprog-in: Set errno to indicate why NULL was returned.
Date: Sat, 28 Sep 2019 13:48:01 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-159-generic; KDE/5.18.0; x86_64; ; )

Eli Zaretskii wrote:
> The value of EACCES (not EACCESS!) on MS-Windows frequently means the
> file cannot be accessed for a reason that has nothing to do with
> execute permissions.  It could be, for example, that some intermediate
> directory in the full file name doesn't exist or is otherwise
> inaccessible.

Thanks for the scrutiny, Eli. Fixed as follows:


2019-09-15  Bruno Haible  <address@hidden>

        findprog-in: Fix comment.
        Reported by Eli Zaretskii <address@hidden>.
        * lib/findprog.h (find_in_given_path): Extend description of EACCES
        condition.
        * lib/stat.c (rpl_stat): Fix typo in comment.
        * lib/utime.c (_gl_utimens_windows): Likewise.

diff --git a/lib/findprog.h b/lib/findprog.h
index 804f02a..263c53c 100644
--- a/lib/findprog.h
+++ b/lib/findprog.h
@@ -50,8 +50,9 @@ extern const char *find_in_path (const char *progname);
    - Otherwise, it sets errno and returns NULL.
      Specific errno values include:
        - ENOENT: means that the program's file was not found.
-       - EACCESS: means that the program's file was found but lacks the
-         execute permissions.
+       - EACCES: means that the program's file cannot be accessed (due to some
+         issue with one of the ancestor directories) or lacks the execute
+         permissions.
    If OPTIMIZE_FOR_EXEC is true, the function saves some work, under the
    assumption that the resulting pathname will not be accessed directly,
    only through execl/execv or execlp/execvp.
diff --git a/lib/stat.c b/lib/stat.c
index 9228500..e3248a8 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -375,7 +375,7 @@ rpl_stat (char const *name, struct stat *buf)
 
       case ERROR_ACCESS_DENIED:  /* rname is such as 'C:\System Volume 
Information\foo'.  */
       case ERROR_SHARING_VIOLATION: /* rname is such as 'C:\pagefile.sys' 
(second approach only).  */
-                                    /* XXX map to EACCESS or EPERM? */
+                                    /* XXX map to EACCES or EPERM? */
         errno = EACCES;
         break;
 
@@ -398,7 +398,7 @@ rpl_stat (char const *name, struct stat *buf)
         errno = ENAMETOOLONG;
         break;
 
-      case ERROR_DELETE_PENDING: /* XXX map to EACCESS or EPERM? */
+      case ERROR_DELETE_PENDING: /* XXX map to EACCES or EPERM? */
         errno = EPERM;
         break;
 
diff --git a/lib/utime.c b/lib/utime.c
index a0466f7..a5a362b 100644
--- a/lib/utime.c
+++ b/lib/utime.c
@@ -224,7 +224,7 @@ _gl_utimens_windows (const char *name, struct timespec 
ts[2])
         errno = ENAMETOOLONG;
         break;
 
-      case ERROR_DELETE_PENDING: /* XXX map to EACCESS or EPERM? */
+      case ERROR_DELETE_PENDING: /* XXX map to EACCES or EPERM? */
         errno = EPERM;
         break;
 




reply via email to

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