-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge drbd-9.1/8597f3d59 'compat: Workaround for Linux-6.12 bug in co…
…mpat test have_strscpy.c'
- Loading branch information
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,19 @@ | |
|
||
#include <linux/string.h> | ||
|
||
/* | ||
* For making it compatible with linux-6.12: | ||
* Work around <linux/compiler.h> defines __must_be_array() and __must_be_cstr() and both expand to | ||
* BUILD_BUG_ON_ZERO(), but <linux/build_bug.h> defines BUILD_BUG_ON_ZERO(). <linux/compiler.h> does | ||
* not include <linux/build_bug.h> and Linus does not want that. | ||
* | ||
* See https://lore.kernel.org/linux-kernel/[email protected]/T/#t | ||
* | ||
*/ | ||
#ifndef BUILD_BUG_ON_ZERO | ||
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ||
#endif | ||
|
||
ssize_t foo(char *dest, const char *src, size_t count) | ||
{ | ||
return strscpy(dest, src, count); | ||
|