diff --git a/daemon/gamemode.c b/daemon/gamemode.c index a3da4bc..f15c0be 100644 --- a/daemon/gamemode.c +++ b/daemon/gamemode.c @@ -74,6 +74,17 @@ POSSIBILITY OF SUCH DAMAGE. #define safe_snprintf(b, s, ...) \ (snprintf(b, sizeof(b), s, __VA_ARGS__) < (ssize_t)sizeof(b) ? strndup(b, sizeof(b)) : NULL) +/** + * Helper function: Test, if haystack ends with needle. + */ +static inline const char *strtail(const char *haystack, const char *needle) +{ + char *pos = strstr(haystack, needle); + if (pos && (strlen(pos) == strlen(needle))) + return pos; + return NULL; +} + /** * The GameModeClient encapsulates the remote connection, providing a list * form to contain the pid and credentials.