diff --git a/lib/misc/util.h b/lib/misc/util.h index 35514eee0..963e43074 100644 --- a/lib/misc/util.h +++ b/lib/misc/util.h @@ -35,6 +35,13 @@ #define uninitialized_var(x) x = x #endif +/* Use wrapper for checked results */ +static inline __attribute__((warn_unused_result)) + int _dm_strncpy(char *dest, const char *src, size_t n) +{ + return dm_strncpy(dest, src, n); +} + /* * GCC 3.4 adds a __builtin_clz, which uses the count leading zeros (clz) * instruction on arches that have one. Provide a fallback using shifts diff --git a/libdm/dm-tools/util.h b/libdm/dm-tools/util.h index 3925a7438..fc60f0437 100644 --- a/libdm/dm-tools/util.h +++ b/libdm/dm-tools/util.h @@ -17,6 +17,13 @@ #include +/* Use wrapper for checked results */ +static inline __attribute__((warn_unused_result)) + int _dm_strncpy(char *dest, const char *src, size_t n) +{ + return dm_strncpy(dest, src, n); +} + #define min(a, b) ({ typeof(a) _a = (a); \ typeof(b) _b = (b); \ (void) (&_a == &_b); \