register_syncdb: reject db names that contain /

alpm downloads databases based on basename causing [foo] and [bar/foo]
to silently overwrite each other.

Also remove an extra tab

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2014-04-26 19:24:55 -04:00 committed by Allan McRae
parent 5293d57840
commit dd694f433b

View file

@ -52,6 +52,7 @@ alpm_db_t SYMEXPORT *alpm_register_syncdb(alpm_handle_t *handle,
CHECK_HANDLE(handle, return NULL); CHECK_HANDLE(handle, return NULL);
ASSERT(treename != NULL && strlen(treename) != 0, ASSERT(treename != NULL && strlen(treename) != 0,
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL)); RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
ASSERT(!strchr(treename, '/'), RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
/* Do not register a database if a transaction is on-going */ /* Do not register a database if a transaction is on-going */
ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, NULL)); ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, NULL));