Fix db_subscr_create() not returning -EEXIST expected by VTY subscriber create cmd

As a result, the -EEXIST code path printing a specific error for
inserting already existing subscribers was not being triggered.

Change-Id: Id24dc6e0ff5115c8c9025404dd7296250d2b03ee
diff --git a/src/db_hlr.c b/src/db_hlr.c
index 591908f..1dc4415 100644
--- a/src/db_hlr.c
+++ b/src/db_hlr.c
@@ -45,7 +45,8 @@
  * \param[in,out] dbc  database context.
  * \param[in] imsi  ASCII string of IMSI digits, is validated.
  * \param[in] flags  Bitmask of DB_SUBSCR_FLAG_*.
- * \returns 0 on success, -EINVAL on invalid IMSI, -EIO on database error.
+ * \returns 0 on success, -EINVAL on invalid IMSI, -EEXIST if subscriber with
+ *          provided imsi already exists, -EIO on other database errors.
  */
 int db_subscr_create(struct db_context *dbc, const char *imsi, uint8_t flags)
 {
@@ -73,6 +74,8 @@
 	if (rc != SQLITE_DONE) {
 		LOGHLR(imsi, LOGL_ERROR, "Cannot create subscriber: SQL error: (%d) %s\n",
 		       rc, sqlite3_errmsg(dbc->db));
+		if (rc == SQLITE_CONSTRAINT_UNIQUE)
+			return -EEXIST;
 		return -EIO;
 	}