mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-21 23:38:49 -05:00
alpm_initialize: Fix double slash in sys hook dir path
The path of the default system hook directory was created by concatenating `myhandle->root` (usually "/"), and SYSHOOKDIR (usually "/usr/share/libalpm/hooks/"), resulting in "//usr/share/libalpm/hooks/". Fix this by skipping the initial slash from SYSHOOKDIR. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
8ee084dbb3
commit
71f9de64c6
@ -65,8 +65,11 @@ alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
MALLOC(hookdir, strlen(myhandle->root) + strlen(SYSHOOKDIR) + 1, goto cleanup);
|
||||
sprintf(hookdir, "%s%s", myhandle->root, SYSHOOKDIR);
|
||||
/* to contatenate myhandle->root (ends with a slash) with SYSHOOKDIR (starts
|
||||
* with a slash) correctly, we skip SYSHOOKDIR[0]; the regular +1 therefore
|
||||
* disappears from the allocation */
|
||||
MALLOC(hookdir, strlen(myhandle->root) + strlen(SYSHOOKDIR), goto cleanup);
|
||||
sprintf(hookdir, "%s%s", myhandle->root, SYSHOOKDIR + 1);
|
||||
myhandle->hookdirs = alpm_list_add(NULL, hookdir);
|
||||
|
||||
/* set default database extension */
|
||||
|
Loading…
Reference in New Issue
Block a user