summaryrefslogtreecommitdiff
path: root/include/stdlib.h
diff options
context:
space:
mode:
authorsin2015-03-13 11:00:46 +0000
committersin2015-03-13 11:00:46 +0000
commit9f8c543dc81f0c4239acae6713f5414eb7dc681d (patch)
tree0c8dad17e27c510cc3c98502841aa1a75dfa3d1e /include/stdlib.h
parentb211796d68c4a6b56f999534627791f3576b6135 (diff)
Rework fortify implementation to use extern inline
Overriding functions with macros is legal in C but a lot of software is not prepared for it. Use the extern inline method to achieve the same result.
Diffstat (limited to '')
-rw-r--r--include/stdlib.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index 4aff9d9..f4a026b 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -12,9 +12,11 @@
12#ifndef __cplusplus 12#ifndef __cplusplus
13 13
14#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 14#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
15static inline __attribute__ ((always_inline)) 15#undef realpath
16char * 16extern char *__realpath_orig(const char *, char *)
17__fortify_realpath(const char *path, char *resolved) 17 __asm__(__USER_LABEL_PREFIX__ "realpath");
18extern __inline __attribute__((__always_inline__,__gnu_inline__))
19char *realpath(const char *path, char *resolved)
18{ 20{
19 size_t bos; 21 size_t bos;
20 22
@@ -27,11 +29,8 @@ __fortify_realpath(const char *path, char *resolved)
27 __builtin_trap(); 29 __builtin_trap();
28#endif 30#endif
29 } 31 }
30 return realpath(path, resolved); 32 return __realpath_orig(path, resolved);
31} 33}
32
33#undef realpath
34#define realpath(path, resolved) __fortify_realpath(path, resolved)
35#endif 34#endif
36 35
37#endif 36#endif