unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] posix: Fix attribute access mode on getcwd with GNU extension [BZ #27476]
@ 2021-09-08 22:52 Aurelien Jarno
  2021-09-10 11:34 ` Florian Weimer via Libc-alpha
  0 siblings, 1 reply; 2+ messages in thread
From: Aurelien Jarno @ 2021-09-08 22:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Aurelien Jarno

There is a GNU extension that allows to call getcwd(NULL, >0). It is
described in the documentation, but also directly in the unistd.h
header, just above the declaration.

Therefore, do not define the attribute access mode when __USE_GNU is in
used.
---
 posix/unistd.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Note: I am aware of BZ #26545, however while it is being discussed, the
bug is still there, so I don't think we should block on a decision to
fix it.

diff --git a/posix/unistd.h b/posix/unistd.h
index 3dca65732f..506d34d2ec 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -529,7 +529,10 @@ extern int fchdir (int __fd) __THROW __wur;
    bytes long, unless SIZE == 0, in which case it is as
    big as necessary.  */
 extern char *getcwd (char *__buf, size_t __size) __THROW __wur
-    __attr_access ((__write_only__, 1, 2));
+#ifndef   __USE_GNU
+    __attr_access ((__write_only__, 1, 2))
+#endif
+    ;
 
 #ifdef	__USE_GNU
 /* Return a malloc'd string containing the current directory name.
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] posix: Fix attribute access mode on getcwd with GNU extension [BZ #27476]
  2021-09-08 22:52 [PATCH] posix: Fix attribute access mode on getcwd with GNU extension [BZ #27476] Aurelien Jarno
@ 2021-09-10 11:34 ` Florian Weimer via Libc-alpha
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer via Libc-alpha @ 2021-09-10 11:34 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: libc-alpha

* Aurelien Jarno:

> There is a GNU extension that allows to call getcwd(NULL, >0). It is
> described in the documentation, but also directly in the unistd.h
> header, just above the declaration.
>
> Therefore, do not define the attribute access mode when __USE_GNU is in
> used.

I think we should drop the attribute unconditionally.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-10 11:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 22:52 [PATCH] posix: Fix attribute access mode on getcwd with GNU extension [BZ #27476] Aurelien Jarno
2021-09-10 11:34 ` Florian Weimer via Libc-alpha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).