]> sourceware.org Git - glibc.git/commitdiff
Fix hurd __access_noerrno implementation.
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 18 Nov 2016 18:41:00 +0000 (16:41 -0200)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 18 Nov 2016 18:49:08 +0000 (16:49 -0200)
This patch fixes some hurd bits from commit afcf3cd8eb that added the
__access_noerrno internal symbol.  It basically removes the nonrequired
__hurd_fail_noerrno (since the 'err' argument is ignored) and fixes
a typo for EACCES.

However, as stated on maillist [1] this __access_noerrno may still be
unsafe to run during initialization of tunables on the Hurd.  The
access_common calls __hurd_file_name_lookup, which calls
__hurd_file_name_lookup_retry, which can set errno.

[1] https://sourceware.org/ml/libc-alpha/2016-11/msg00646.html

ChangeLog
hurd/hurd.h
include/unistd.h
sysdeps/mach/hurd/access.c

index 4c90aa099ed90bc0aaaa5cb49be3182e4da8a50d..b923ac9acfa09e063dec0bcdea5f660660a71ff4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-11-18  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+       * hurd/hurd.h (__hurd_fail_noerrno): Remove function.
+       * include/unistd.h: Extend comment about __access_noerrno return
+       semantics.
+       * sysdeps/match/hurd/access.c (__hurd_fail_noerrno): Return -1.
+       (access_common): Correct typo for EACCES.
+
 2016-11-18  Chris Metcalf  <cmetcalf@mellanox.com>
 
        * sysdeps/tile/math-tests.h: New file.
index c089d4c4455f7661cea70497914538fb89098cce..ec0782797d7be0785463ce634e558938a1243e76 100644 (file)
@@ -75,35 +75,6 @@ __hurd_fail (error_t err)
   errno = err;
   return -1;
 }
-
-_HURD_H_EXTERN_INLINE int
-__hurd_fail_noerrno (error_t err)
-{
-  switch (err)
-    {
-    case EMACH_SEND_INVALID_DEST:
-    case EMIG_SERVER_DIED:
-      /* The server has disappeared!  */
-      err = EIEIO;
-      break;
-
-    case KERN_NO_SPACE:
-      err = ENOMEM;
-      break;
-
-    case KERN_INVALID_ARGUMENT:
-      err = EINVAL;
-      break;
-
-    case 0:
-      return 0;
-
-    default:
-      break;
-    }
-
-  return -1;
-}
 \f
 /* Basic ports and info, initialized by startup.  */
 
index 6144f411aaec27f5ae25b78a544f7b859140a3ae..16d68a15056f7d7cb37ab8a3777bc76cb10f5ac7 100644 (file)
@@ -183,7 +183,8 @@ extern int __getlogin_r_loginuid (char *name, size_t namesize)
 
 #  if IS_IN (rtld) || !defined SHARED
 /* __access variant that does not set errno.  Used in very early initialization
-   code in libc.a and ld.so.  */
+   code in libc.a and ld.so.  It follows access return semantics (zero for
+   sucess otherwise a value different than 0).  */
 extern __typeof (__access) __access_noerrno attribute_hidden;
 #  endif
 
index 93e21666f89be7528523b29cfb6e9ed7105e1ec5..0df939a64cf8a08a6bebd21c7653bc600c21973e 100644 (file)
@@ -31,7 +31,7 @@ hurd_fail_seterrno (error_t err)
 static int
 hurd_fail_noerrno (error_t err)
 {
-  return __hurd_fail_noerrno (err);
+  return -1;
 }
 
 static int
@@ -149,13 +149,15 @@ access_common (const char *file, int type, int (*errfunc) (error_t))
 
   if (flags & ~allowed)
     /* We are not allowed all the requested types of access.  */
-    return errfunc (EACESS);
+    return errfunc (EACCES);
 
   return 0;
 }
 
 /* Test for access to FILE by our real user and group IDs without setting
-   errno.  */
+   errno.  This may be unsafe to run during initialization of tunables
+   since access_common calls __hurd_file_name_lookup, which calls
+   __hurd_file_name_lookup_retry, which can set errno.  */
 int
 __access_noerrno (const char *file, int type)
 {
This page took 0.155376 seconds and 5 git commands to generate.