From f2a7fb2b96dd76f48b7750d1edeb6a85b7006856 Mon Sep 17 00:00:00 2001 From: Rikard Falkeborn Date: Fri, 5 Apr 2019 00:02:51 +0200 Subject: Fix clang 8 string-plus-int warnings Clang 8 warns that adding a string to an integer does not append to string. Indeed it doesn't, but that was not the intentetion. Use array indexing as suggested by the compiler to silence the warning. There should be no functional change. Example of warning message: alpm.c:71:54: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] sprintf(hookdir, "%s%s", myhandle->root, SYSHOOKDIR + 1); ~~~~~~~~~~~^~~ alpm.c:71:54: note: use array indexing to silence this warning sprintf(hookdir, "%s%s", myhandle->root, SYSHOOKDIR + 1); ^ & [ ] 1 warning generated. --- lib/libalpm/alpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 0f3db6f4..bd7a129a 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -68,7 +68,7 @@ alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath, * with a slash) correctly, we skip SYSHOOKDIR[0]; the regular +1 therefore * disappears from the allocation */ MALLOC(hookdir, strlen(myhandle->root) + strlen(SYSHOOKDIR), goto nomem); - sprintf(hookdir, "%s%s", myhandle->root, SYSHOOKDIR + 1); + sprintf(hookdir, "%s%s", myhandle->root, &SYSHOOKDIR[1]); myhandle->hookdirs = alpm_list_add(NULL, hookdir); /* set default database extension */ -- cgit v1.2.3-70-g09d2