diff --git a/src/ckdb.h b/src/ckdb.h index 3b5c9711..f19b174a 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -51,7 +51,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.5" -#define CKDB_VERSION DB_VERSION"-1.983" +#define CKDB_VERSION DB_VERSION"-1.984" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_dbio.c b/src/ckdb_dbio.c index 45e2e52d..8d707403 100644 --- a/src/ckdb_dbio.c +++ b/src/ckdb_dbio.c @@ -3640,6 +3640,7 @@ bool shares_add(PGconn *conn, char *workinfoid, char *username, char *workername USERS *users; bool ok = false; char *st = NULL; + int errn_int; LOGDEBUG("%s(): %s/%s/%s/%s/%ld,%ld", __func__, @@ -3648,10 +3649,13 @@ bool shares_add(PGconn *conn, char *workinfoid, char *username, char *workername FREENULL(st); TXT_TO_DOUBLE("sdiff", sdiff, sdiff_amt); + TXT_TO_INT("errn", errn, errn_int); K_WLOCK(shares_free); s_item = k_unlink_head(shares_free); - if (share_min_sdiff > 0 && sdiff_amt >= share_min_sdiff) + // Don't store duplicates since they will already exist + if (errn_int != SE_DUPE && share_min_sdiff > 0 && + sdiff_amt >= share_min_sdiff) s2_item = k_unlink_head(shares_free); K_WUNLOCK(shares_free);