posix: Fix attribute access mode on getcwd with GNU extension [BZ #27476]
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
Commit Message
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.
Comments
* 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
@@ -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.