mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
debug: Improve mqueue.h fortify warnings with clang
It improve mq_open. The compile and runtime checks have similar coverage as with GCC. Checked on aarch64, armhf, x86_64, and i686. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
parent
86889e22db
commit
c23107effb
@ -29,6 +29,8 @@ extern mqd_t __mq_open_2 (const char *__name, int __oflag)
|
|||||||
extern mqd_t __REDIRECT_NTH (__mq_open_alias, (const char *__name,
|
extern mqd_t __REDIRECT_NTH (__mq_open_alias, (const char *__name,
|
||||||
int __oflag, ...), mq_open)
|
int __oflag, ...), mq_open)
|
||||||
__nonnull ((1));
|
__nonnull ((1));
|
||||||
|
|
||||||
|
#ifdef __va_arg_pack_len
|
||||||
__errordecl (__mq_open_wrong_number_of_args,
|
__errordecl (__mq_open_wrong_number_of_args,
|
||||||
"mq_open can be called either with 2 or 4 arguments");
|
"mq_open can be called either with 2 or 4 arguments");
|
||||||
__errordecl (__mq_open_missing_mode_and_attr,
|
__errordecl (__mq_open_missing_mode_and_attr,
|
||||||
@ -55,3 +57,30 @@ __NTH (mq_open (const char *__name, int __oflag, ...))
|
|||||||
|
|
||||||
return __mq_open_alias (__name, __oflag, __va_arg_pack ());
|
return __mq_open_alias (__name, __oflag, __va_arg_pack ());
|
||||||
}
|
}
|
||||||
|
#elif __fortify_use_clang
|
||||||
|
__fortify_function_error_function __attribute_overloadable__ mqd_t
|
||||||
|
__NTH (mq_open (const char *__name, int __oflag, mode_t mode))
|
||||||
|
__fortify_clang_unavailable ("mq_open can be called either with 2 or 4 arguments");
|
||||||
|
|
||||||
|
__fortify_function_error_function __attribute_overloadable__ mqd_t
|
||||||
|
__NTH (mq_open (const char *__name, int __oflag, mode_t mode,
|
||||||
|
struct mq_attr *attr, ...))
|
||||||
|
__fortify_clang_unavailable ("mq_open can be called either with 2 or 4 arguments");
|
||||||
|
|
||||||
|
__fortify_function __attribute_overloadable__ mqd_t
|
||||||
|
__NTH (mq_open (__fortify_clang_overload_arg (const char *, ,__name),
|
||||||
|
int __oflag))
|
||||||
|
__fortify_clang_prefer_this_overload
|
||||||
|
__fortify_clang_error ((__oflag & O_CREAT),
|
||||||
|
"mq_open with O_CREAT in second argument needs 4 arguments")
|
||||||
|
{
|
||||||
|
return __mq_open_alias (__name, __oflag);
|
||||||
|
}
|
||||||
|
|
||||||
|
__fortify_function __attribute_overloadable__ mqd_t
|
||||||
|
__NTH (mq_open (__fortify_clang_overload_arg (const char *, ,__name),
|
||||||
|
int __oflag, int __mode, struct mq_attr *__attr))
|
||||||
|
{
|
||||||
|
return __mq_open_alias (__name, __oflag, __mode, __attr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -110,8 +110,7 @@ extern int __REDIRECT (mq_timedsend, (mqd_t __mqdes,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define some inlines helping to catch common problems. */
|
/* Define some inlines helping to catch common problems. */
|
||||||
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
|
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
|
||||||
&& defined __va_arg_pack_len
|
|
||||||
# include <bits/mqueue2.h>
|
# include <bits/mqueue2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user